From 6671f48e21fc291d2f0ccbdb3ce78e30e75b85b2 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:29:18 +0800 Subject: [PATCH 1/8] generate DevTestLabs by autorest v2 --- .../DevTestLabs.Management.Sdk.csproj | 13 + .../Generated/ArmTemplatesOperations.cs | 667 +++ .../ArmTemplatesOperationsExtensions.cs | 170 + .../Generated/ArtifactSourcesOperations.cs | 1289 +++++ .../ArtifactSourcesOperationsExtensions.cs | 305 ++ .../Generated/ArtifactsOperations.cs | 896 ++++ .../ArtifactsOperationsExtensions.cs | 230 + .../Generated/CostsOperations.cs | 504 ++ .../Generated/CostsOperationsExtensions.cs | 129 + .../Generated/CustomImagesOperations.cs | 1348 ++++++ .../CustomImagesOperationsExtensions.cs | 404 ++ .../Generated/DevTestLabsClient.cs | 504 ++ .../Generated/DisksOperations.cs | 1875 ++++++++ .../Generated/DisksOperationsExtensions.cs | 674 +++ .../Generated/EnvironmentsOperations.cs | 1396 ++++++ .../EnvironmentsOperationsExtensions.cs | 448 ++ .../Generated/FormulasOperations.cs | 1319 ++++++ .../Generated/FormulasOperationsExtensions.cs | 361 ++ .../Generated/GalleryImagesOperations.cs | 436 ++ .../GalleryImagesOperationsExtensions.cs | 106 + .../Generated/GlobalSchedulesOperations.cs | 2020 ++++++++ .../GlobalSchedulesOperationsExtensions.cs | 507 ++ .../Generated/IArmTemplatesOperations.cs | 116 + .../Generated/IArtifactSourcesOperations.cs | 197 + .../Generated/IArtifactsOperations.cs | 151 + .../Generated/ICostsOperations.cs | 90 + .../Generated/ICustomImagesOperations.cs | 254 + .../Generated/IDevTestLabsClient.cs | 198 + .../Generated/IDisksOperations.cs | 403 ++ .../Generated/IEnvironmentsOperations.cs | 276 ++ .../Generated/IFormulasOperations.cs | 233 + .../Generated/IGalleryImagesOperations.cs | 78 + .../Generated/IGlobalSchedulesOperations.cs | 321 ++ .../Generated/ILabsOperations.cs | 557 +++ .../INotificationChannelsOperations.cs | 225 + .../Generated/IOperations.cs | 52 + .../Generated/IPoliciesOperations.cs | 212 + .../Generated/IPolicySetsOperations.cs | 58 + .../Generated/IProviderOperations.cs | 68 + .../Generated/ISchedulesOperations.cs | 296 ++ .../Generated/ISecretsOperations.cs | 247 + .../IServiceFabricSchedulesOperations.cs | 288 ++ .../Generated/IServiceFabricsOperations.cs | 421 ++ .../Generated/IServiceRunnersOperations.cs | 162 + .../Generated/IUsersOperations.cs | 254 + .../IVirtualMachineSchedulesOperations.cs | 267 ++ .../Generated/IVirtualMachinesOperations.cs | 912 ++++ .../Generated/IVirtualNetworksOperations.cs | 257 + .../Generated/LabsOperations.cs | 3085 ++++++++++++ .../Generated/LabsOperationsExtensions.cs | 904 ++++ .../Generated/Models/ApplicableSchedule.cs | 75 + .../Models/ApplicableScheduleFragment.cs | 71 + .../Generated/Models/ApplyArtifactsRequest.cs | 53 + .../Generated/Models/ArmTemplate.cs | 125 + .../Generated/Models/ArmTemplateInfo.cs | 60 + .../Models/ArmTemplateParameterProperties.cs | 61 + .../ArmTemplateParameterPropertiesFragment.cs | 61 + .../Generated/Models/Artifact.cs | 118 + .../ArtifactDeploymentStatusProperties.cs | 74 + ...ifactDeploymentStatusPropertiesFragment.cs | 74 + .../Models/ArtifactInstallProperties.cs | 105 + .../ArtifactInstallPropertiesFragment.cs | 107 + .../Models/ArtifactParameterProperties.cs | 61 + .../ArtifactParameterPropertiesFragment.cs | 61 + .../Generated/Models/ArtifactSource.cs | 156 + .../Models/ArtifactSourceFragment.cs | 125 + .../Generated/Models/AttachDiskProperties.cs | 53 + .../Models/AttachNewDataDiskOptions.cs | 71 + .../AttachNewDataDiskOptionsFragment.cs | 73 + .../Models/BulkCreationParameters.cs | 52 + .../Models/BulkCreationParametersFragment.cs | 54 + .../Generated/Models/ComputeDataDisk.cs | 78 + .../Models/ComputeDataDiskFragment.cs | 78 + .../Models/ComputeVmInstanceViewStatus.cs | 71 + .../ComputeVmInstanceViewStatusFragment.cs | 71 + .../Generated/Models/ComputeVmProperties.cs | 107 + .../Models/ComputeVmPropertiesFragment.cs | 109 + .../Models/CostThresholdProperties.cs | 94 + .../Generated/Models/CostThresholdStatus.cs | 22 + .../Generated/Models/CostType.cs | 23 + .../Generated/Models/CustomImage.cs | 179 + .../Generated/Models/CustomImageFragment.cs | 135 + .../Generated/Models/CustomImageOsType.cs | 23 + .../Models/CustomImagePropertiesCustom.cs | 86 + .../CustomImagePropertiesCustomFragment.cs | 72 + .../Models/CustomImagePropertiesFromPlan.cs | 74 + .../CustomImagePropertiesFromPlanFragment.cs | 74 + .../Models/CustomImagePropertiesFromVm.cs | 71 + .../CustomImagePropertiesFromVmFragment.cs | 71 + .../Generated/Models/DataDiskProperties.cs | 76 + .../Models/DataDiskPropertiesFragment.cs | 76 + .../Models/DataDiskStorageTypeInfo.cs | 61 + .../Models/DataDiskStorageTypeInfoFragment.cs | 63 + .../Generated/Models/DayDetails.cs | 51 + .../Generated/Models/DayDetailsFragment.cs | 51 + .../Models/DetachDataDiskProperties.cs | 53 + .../Generated/Models/DetachDiskProperties.cs | 53 + .../Generated/Models/Disk.cs | 149 + .../Generated/Models/DiskFragment.cs | 119 + .../Generated/Models/DtlEnvironment.cs | 109 + .../Models/DtlEnvironmentFragment.cs | 69 + .../Generated/Models/EnableStatus.cs | 22 + .../Models/EnvironmentDeploymentProperties.cs | 65 + ...EnvironmentDeploymentPropertiesFragment.cs | 65 + .../Generated/Models/EnvironmentPermission.cs | 22 + .../Models/EvaluatePoliciesProperties.cs | 76 + .../Models/EvaluatePoliciesRequest.cs | 53 + .../Models/EvaluatePoliciesResponse.cs | 53 + .../Generated/Models/EventFragment.cs | 55 + .../Generated/Models/EventModel.cs | 55 + .../Models/ExportResourceUsageParameters.cs | 68 + .../Generated/Models/ExternalSubnet.cs | 59 + .../Models/ExternalSubnetFragment.cs | 59 + .../Generated/Models/FileUploadOptions.cs | 22 + .../Generated/Models/Formula.cs | 124 + .../Generated/Models/FormulaFragment.cs | 93 + .../Models/FormulaPropertiesFromVm.cs | 53 + .../Models/FormulaPropertiesFromVmFragment.cs | 55 + .../Generated/Models/GalleryImage.cs | 125 + .../Generated/Models/GalleryImageReference.cs | 83 + .../Models/GalleryImageReferenceFragment.cs | 85 + .../Models/GenerateArmTemplateRequest.cs | 84 + .../Models/GenerateUploadUriParameter.cs | 51 + .../Models/GenerateUploadUriResponse.cs | 51 + .../Generated/Models/HostCachingOptions.cs | 23 + .../Generated/Models/HourDetails.cs | 52 + .../Generated/Models/HourDetailsFragment.cs | 52 + .../Generated/Models/HttpStatusCode.cs | 62 + .../Generated/Models/IdentityProperties.cs | 77 + .../Models/ImportLabVirtualMachineRequest.cs | 65 + .../Generated/Models/InboundNatRule.cs | 77 + .../Models/InboundNatRuleFragment.cs | 77 + .../Generated/Models/Lab.cs | 261 ++ .../Models/LabAnnouncementProperties.cs | 109 + .../LabAnnouncementPropertiesFragment.cs | 93 + .../Generated/Models/LabCost.cs | 140 + .../Models/LabCostDetailsProperties.cs | 69 + .../Models/LabCostSummaryProperties.cs | 52 + .../Generated/Models/LabFragment.cs | 147 + .../Models/LabResourceCostProperties.cs | 124 + .../Generated/Models/LabSupportProperties.cs | 64 + .../Models/LabSupportPropertiesFragment.cs | 66 + .../Generated/Models/LabVhd.cs | 51 + .../Generated/Models/LabVirtualMachine.cs | 382 ++ .../LabVirtualMachineCreationParameter.cs | 377 ++ ...VirtualMachineCreationParameterFragment.cs | 377 ++ .../Models/LabVirtualMachineFragment.cs | 342 ++ .../Generated/Models/LinuxOsInfo.cs | 56 + .../Generated/Models/LinuxOsInfoFragment.cs | 56 + .../Generated/Models/LinuxOsState.cs | 23 + .../Models/NetworkInterfaceProperties.cs | 127 + .../NetworkInterfacePropertiesFragment.cs | 129 + .../Generated/Models/NotificationChannel.cs | 129 + .../Models/NotificationChannelEventType.cs | 22 + .../Models/NotificationChannelFragment.cs | 100 + .../Generated/Models/NotificationSettings.cs | 95 + .../Models/NotificationSettingsFragment.cs | 97 + .../Generated/Models/NotifyParameters.cs | 62 + .../Generated/Models/OperationError.cs | 60 + .../Generated/Models/OperationMetadata.cs | 61 + .../Models/OperationMetadataDisplay.cs | 79 + .../Generated/Models/OperationResult.cs | 94 + .../Generated/Models/Page.cs | 53 + .../Generated/Models/ParameterInfo.cs | 59 + .../Models/ParametersValueFileInfo.cs | 59 + .../PercentageCostThresholdProperties.cs | 53 + .../Generated/Models/Policy.cs | 148 + .../Generated/Models/PolicyEvaluatorType.cs | 22 + .../Generated/Models/PolicyFactName.cs | 30 + .../Generated/Models/PolicyFragment.cs | 118 + .../Generated/Models/PolicySetResult.cs | 64 + .../Generated/Models/PolicyStatus.cs | 22 + .../Generated/Models/PolicyViolation.cs | 59 + .../Generated/Models/Port.cs | 62 + .../Generated/Models/PortFragment.cs | 62 + .../Generated/Models/PremiumDataDisk.cs | 22 + .../Generated/Models/RdpConnection.cs | 51 + .../Generated/Models/ReportingCycleType.cs | 22 + .../ResizeLabVirtualMachineProperties.cs | 54 + .../Generated/Models/Resource.cs | 87 + .../Models/RetargetScheduleProperties.cs | 63 + .../Generated/Models/Schedule.cs | 157 + .../Models/ScheduleCreationParameter.cs | 150 + .../ScheduleCreationParameterFragment.cs | 152 + .../Generated/Models/ScheduleFragment.cs | 126 + .../Generated/Models/Secret.cs | 81 + .../Generated/Models/SecretFragment.cs | 59 + .../Generated/Models/ServiceFabric.cs | 100 + .../Generated/Models/ServiceFabricFragment.cs | 69 + .../Generated/Models/ServiceRunner.cs | 59 + .../SharedPublicIpAddressConfiguration.cs | 56 + ...redPublicIpAddressConfigurationFragment.cs | 56 + .../Models/ShutdownNotificationContent.cs | 158 + .../Generated/Models/SourceControlType.cs | 22 + .../Generated/Models/StorageType.cs | 22 + .../Generated/Models/Subnet.cs | 72 + .../Generated/Models/SubnetFragment.cs | 72 + .../Generated/Models/SubnetOverride.cs | 104 + .../Models/SubnetOverrideFragment.cs | 104 + ...ubnetSharedPublicIpAddressConfiguration.cs | 57 + ...redPublicIpAddressConfigurationFragment.cs | 57 + .../Generated/Models/TargetCostProperties.cs | 98 + .../Generated/Models/TargetCostStatus.cs | 22 + .../Generated/Models/TransportProtocol.cs | 22 + .../Generated/Models/UpdateResource.cs | 53 + .../Generated/Models/UsagePermissionType.cs | 23 + .../Generated/Models/User.cs | 97 + .../Generated/Models/UserFragment.cs | 66 + .../Generated/Models/UserIdentity.cs | 97 + .../Generated/Models/UserIdentityFragment.cs | 97 + .../Generated/Models/UserSecretStore.cs | 59 + .../Models/UserSecretStoreFragment.cs | 59 + .../Models/VirtualMachineCreationSource.cs | 22 + .../Generated/Models/VirtualNetwork.cs | 127 + .../Models/VirtualNetworkFragment.cs | 87 + .../Generated/Models/WeekDetails.cs | 64 + .../Generated/Models/WeekDetailsFragment.cs | 64 + .../Generated/Models/WindowsOsInfo.cs | 56 + .../Generated/Models/WindowsOsInfoFragment.cs | 56 + .../Generated/Models/WindowsOsState.cs | 23 + .../NotificationChannelsOperations.cs | 1487 ++++++ ...otificationChannelsOperationsExtensions.cs | 354 ++ .../Generated/Operations.cs | 250 + .../Generated/OperationsExtensions.cs | 65 + .../Generated/PoliciesOperations.cs | 1334 ++++++ .../Generated/PoliciesOperationsExtensions.cs | 335 ++ .../Generated/PolicySetsOperations.cs | 273 ++ .../PolicySetsOperationsExtensions.cs | 77 + .../Generated/ProviderOperations.cs | 400 ++ .../Generated/ProviderOperationsExtensions.cs | 87 + .../Generated/SchedulesOperations.cs | 1876 ++++++++ .../SchedulesOperationsExtensions.cs | 471 ++ .../Generated/SdkInfo_DevTestLabsClient.cs | 51 + .../Generated/SecretsOperations.cs | 1367 ++++++ .../Generated/SecretsOperationsExtensions.cs | 397 ++ .../ServiceFabricSchedulesOperations.cs | 1612 +++++++ ...viceFabricSchedulesOperationsExtensions.cs | 475 ++ .../Generated/ServiceFabricsOperations.cs | 2052 ++++++++ .../ServiceFabricsOperationsExtensions.cs | 696 +++ .../Generated/ServiceRunnersOperations.cs | 1062 +++++ .../ServiceRunnersOperationsExtensions.cs | 247 + .../Generated/UsersOperations.cs | 1344 ++++++ .../Generated/UsersOperationsExtensions.cs | 404 ++ .../VirtualMachineSchedulesOperations.cs | 1555 +++++++ ...ualMachineSchedulesOperationsExtensions.cs | 433 ++ .../Generated/VirtualMachinesOperations.cs | 4135 +++++++++++++++++ .../VirtualMachinesOperationsExtensions.cs | 1518 ++++++ .../Generated/VirtualNetworksOperations.cs | 1344 ++++++ .../VirtualNetworksOperationsExtensions.cs | 404 ++ .../Properties/AssemblyInfo.cs | 29 + .../DevTestLabs.Management.Sdk/README.md | 34 + 251 files changed, 66251 insertions(+) create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/DevTestLabs.Management.Sdk.csproj create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricSchedulesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptionsFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParametersFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustomFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlan.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlanFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVmFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfo.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfoFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironmentFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentPermission.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVmFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ImportLabVirtualMachineRequest.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfoFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RdpConnection.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ResizeLabVirtualMachineProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameter.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameterFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabric.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabricFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UpdateResource.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfoFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Properties/AssemblyInfo.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/README.md diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/DevTestLabs.Management.Sdk.csproj b/src/DevTestLabs/DevTestLabs.Management.Sdk/DevTestLabs.Management.Sdk.csproj new file mode 100644 index 000000000000..441a3ab82e71 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/DevTestLabs.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + DevTestLabs + + + + netstandard2.0 + Microsoft.Azure.PowerShell.DevTestLabs.Management.Sdk + Microsoft.Azure.Management.DevTestLabs + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs new file mode 100644 index 000000000000..ec387a5bacf8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.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.DevTestLabs +{ + 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; + + /// + /// ArmTemplatesOperations operations. + /// + internal partial class ArmTemplatesOperations : IServiceOperations, IArmTemplatesOperations + { + /// + /// Initializes a new instance of the ArmTemplatesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ArmTemplatesOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (artifactSourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + 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.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 azure resource manager template. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string artifactSourceName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (artifactSourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 azure resource manager templates in a given artifact source. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs new file mode 100644 index 000000000000..afc94bbbd57a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs @@ -0,0 +1,170 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ArmTemplatesOperations. + /// + public static partial class ArmTemplatesOperationsExtensions + { + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IArmTemplatesOperations operations, string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IArmTemplatesOperations operations, string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get azure resource manager template. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + public static ArmTemplate Get(this IArmTemplatesOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get azure resource manager template. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IArmTemplatesOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IArmTemplatesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// 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 IArmTemplatesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs new file mode 100644 index 000000000000..63061ca56f84 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs @@ -0,0 +1,1289 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// ArtifactSourcesOperations operations. + /// + internal partial class ArtifactSourcesOperations : IServiceOperations, IArtifactSourcesOperations + { + /// + /// Initializes a new instance of the ArtifactSourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ArtifactSourcesOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List artifact sources in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/artifactsources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, ArtifactSource artifactSource, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (artifactSource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "artifactSource"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("artifactSource", artifactSource); + 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.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(artifactSource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(artifactSource, 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); + } + System.Net.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; + } + + /// + /// Delete artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of artifact sources. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, ArtifactSourceFragment artifactSource, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (artifactSource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "artifactSource"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("artifactSource", artifactSource); + 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.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(artifactSource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(artifactSource, 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); + } + System.Net.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 artifact sources in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs new file mode 100644 index 000000000000..fe37b564812f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs @@ -0,0 +1,305 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ArtifactSourcesOperations. + /// + public static partial class ArtifactSourcesOperationsExtensions + { + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + public static ArtifactSource Get(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, ArtifactSource artifactSource) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, artifactSource).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, ArtifactSource artifactSource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static void Delete(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of artifact sources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + public static ArtifactSource Update(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, ArtifactSourceFragment artifactSource) + { + return operations.UpdateAsync(resourceGroupName, labName, name, artifactSource).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of artifact sources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, ArtifactSourceFragment artifactSource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IArtifactSourcesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List artifact sources in a given lab. + /// + /// + /// 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 IArtifactSourcesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs new file mode 100644 index 000000000000..ab7a2811546d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs @@ -0,0 +1,896 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// ArtifactsOperations operations. + /// + internal partial class ArtifactsOperations : IServiceOperations, IArtifactsOperations + { + /// + /// Initializes a new instance of the ArtifactsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ArtifactsOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List artifacts in a given artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (artifactSourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + 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.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 artifact. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string artifactSourceName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (artifactSourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GenerateArmTemplateWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (artifactSourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (generateArmTemplateRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "generateArmTemplateRequest"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + tracingParameters.Add("name", name); + tracingParameters.Add("generateArmTemplateRequest", generateArmTemplateRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GenerateArmTemplate", 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.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(generateArmTemplateRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(generateArmTemplateRequest, 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); + } + System.Net.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 artifacts in a given artifact source. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs new file mode 100644 index 000000000000..207fbb2fe011 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs @@ -0,0 +1,230 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ArtifactsOperations. + /// + public static partial class ArtifactsOperationsExtensions + { + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + public static Artifact Get(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// + public static ArmTemplateInfo GenerateArmTemplate(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest) + { + return operations.GenerateArmTemplateAsync(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest).GetAwaiter().GetResult(); + } + + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// + /// + /// The cancellation token. + /// + public static async Task GenerateArmTemplateAsync(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateArmTemplateWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IArtifactsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List artifacts in a given artifact source. + /// + /// + /// 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 IArtifactsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs new file mode 100644 index 000000000000..e4131f6acdc6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs @@ -0,0 +1,504 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// CostsOperations operations. + /// + internal partial class CostsOperations : IServiceOperations, ICostsOperations + { + /// + /// Initializes a new instance of the CostsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CostsOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// Get cost. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/costs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing cost. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// A cost item. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, LabCost labCost, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (labCost == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labCost"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("labCost", labCost); + 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.DevTestLab/labs/{labName}/costs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(labCost != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labCost, 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); + } + System.Net.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; + } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs new file mode 100644 index 000000000000..499d0b1d761f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CostsOperations. + /// + public static partial class CostsOperationsExtensions + { + /// + /// Get cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + public static LabCost Get(this ICostsOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICostsOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// A cost item. + /// + public static LabCost CreateOrUpdate(this ICostsOperations operations, string resourceGroupName, string labName, string name, LabCost labCost) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, labCost).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// A cost item. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICostsOperations operations, string resourceGroupName, string labName, string name, LabCost labCost, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labCost, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs new file mode 100644 index 000000000000..225a8c040b9a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs @@ -0,0 +1,1348 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// CustomImagesOperations operations. + /// + internal partial class CustomImagesOperations : IServiceOperations, ICustomImagesOperations + { + /// + /// Initializes a new instance of the CustomImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CustomImagesOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List custom images in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/customimages").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 custom image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/customimages/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, customImage, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of custom images. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, CustomImageFragment customImage, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (customImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customImage"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("customImage", customImage); + 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.DevTestLab/labs/{labName}/customimages/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(customImage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(customImage, 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); + } + System.Net.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 replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, CustomImage customImage, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (customImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customImage"); + } + if (customImage != null) + { + customImage.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("customImage", customImage); + 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.DevTestLab/labs/{labName}/customimages/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(customImage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(customImage, 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); + } + System.Net.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; + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/customimages/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 custom images in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs new file mode 100644 index 000000000000..d600fc47b4d0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs @@ -0,0 +1,404 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CustomImagesOperations. + /// + public static partial class CustomImagesOperationsExtensions + { + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this ICustomImagesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get custom image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + public static CustomImage Get(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get custom image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImage customImage) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, customImage).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImage customImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static void Delete(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of custom images. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + public static CustomImage Update(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImageFragment customImage) + { + return operations.UpdateAsync(resourceGroupName, labName, name, customImage).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of custom images. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImageFragment customImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImage customImage) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, customImage).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImage customImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static void BeginDelete(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICustomImagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List custom images in a given lab. + /// + /// + /// 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 ICustomImagesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs new file mode 100644 index 000000000000..806b878deb1d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs @@ -0,0 +1,504 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// The DevTest Labs Client. + /// + public partial class DevTestLabsClient : ServiceClient, IDevTestLabsClient, 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; } + + /// + /// Client API version. + /// + public string ApiVersion { get; private set; } + + /// + /// The subscription ID. + /// + 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 IProviderOperations. + /// + public virtual IProviderOperations ProviderOperations { get; private set; } + + /// + /// Gets the ILabsOperations. + /// + public virtual ILabsOperations Labs { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IGlobalSchedulesOperations. + /// + public virtual IGlobalSchedulesOperations GlobalSchedules { get; private set; } + + /// + /// Gets the IArtifactSourcesOperations. + /// + public virtual IArtifactSourcesOperations ArtifactSources { get; private set; } + + /// + /// Gets the IArmTemplatesOperations. + /// + public virtual IArmTemplatesOperations ArmTemplates { get; private set; } + + /// + /// Gets the IArtifactsOperations. + /// + public virtual IArtifactsOperations Artifacts { get; private set; } + + /// + /// Gets the ICostsOperations. + /// + public virtual ICostsOperations Costs { get; private set; } + + /// + /// Gets the ICustomImagesOperations. + /// + public virtual ICustomImagesOperations CustomImages { get; private set; } + + /// + /// Gets the IFormulasOperations. + /// + public virtual IFormulasOperations Formulas { get; private set; } + + /// + /// Gets the IGalleryImagesOperations. + /// + public virtual IGalleryImagesOperations GalleryImages { get; private set; } + + /// + /// Gets the INotificationChannelsOperations. + /// + public virtual INotificationChannelsOperations NotificationChannels { get; private set; } + + /// + /// Gets the IPolicySetsOperations. + /// + public virtual IPolicySetsOperations PolicySets { get; private set; } + + /// + /// Gets the IPoliciesOperations. + /// + public virtual IPoliciesOperations Policies { get; private set; } + + /// + /// Gets the ISchedulesOperations. + /// + public virtual ISchedulesOperations Schedules { get; private set; } + + /// + /// Gets the IServiceRunnersOperations. + /// + public virtual IServiceRunnersOperations ServiceRunners { get; private set; } + + /// + /// Gets the IUsersOperations. + /// + public virtual IUsersOperations Users { get; private set; } + + /// + /// Gets the IDisksOperations. + /// + public virtual IDisksOperations Disks { get; private set; } + + /// + /// Gets the IEnvironmentsOperations. + /// + public virtual IEnvironmentsOperations Environments { get; private set; } + + /// + /// Gets the ISecretsOperations. + /// + public virtual ISecretsOperations Secrets { get; private set; } + + /// + /// Gets the IServiceFabricsOperations. + /// + public virtual IServiceFabricsOperations ServiceFabrics { get; private set; } + + /// + /// Gets the IServiceFabricSchedulesOperations. + /// + public virtual IServiceFabricSchedulesOperations ServiceFabricSchedules { get; private set; } + + /// + /// Gets the IVirtualMachinesOperations. + /// + public virtual IVirtualMachinesOperations VirtualMachines { get; private set; } + + /// + /// Gets the IVirtualMachineSchedulesOperations. + /// + public virtual IVirtualMachineSchedulesOperations VirtualMachineSchedules { get; private set; } + + /// + /// Gets the IVirtualNetworksOperations. + /// + public virtual IVirtualNetworksOperations VirtualNetworks { get; private set; } + + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling DevTestLabsClient.Dispose(). False: will not dispose provided httpClient + protected DevTestLabsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected DevTestLabsClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected DevTestLabsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DevTestLabsClient 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 DevTestLabsClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the DevTestLabsClient 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 DevTestLabsClient(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 DevTestLabsClient 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 DevTestLabsClient(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 DevTestLabsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling DevTestLabsClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public DevTestLabsClient(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 DevTestLabsClient 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 DevTestLabsClient(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 DevTestLabsClient 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 DevTestLabsClient(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 DevTestLabsClient 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 DevTestLabsClient(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() + { + ProviderOperations = new ProviderOperations(this); + Labs = new LabsOperations(this); + Operations = new Operations(this); + GlobalSchedules = new GlobalSchedulesOperations(this); + ArtifactSources = new ArtifactSourcesOperations(this); + ArmTemplates = new ArmTemplatesOperations(this); + Artifacts = new ArtifactsOperations(this); + Costs = new CostsOperations(this); + CustomImages = new CustomImagesOperations(this); + Formulas = new FormulasOperations(this); + GalleryImages = new GalleryImagesOperations(this); + NotificationChannels = new NotificationChannelsOperations(this); + PolicySets = new PolicySetsOperations(this); + Policies = new PoliciesOperations(this); + Schedules = new SchedulesOperations(this); + ServiceRunners = new ServiceRunnersOperations(this); + Users = new UsersOperations(this); + Disks = new DisksOperations(this); + Environments = new EnvironmentsOperations(this); + Secrets = new SecretsOperations(this); + ServiceFabrics = new ServiceFabricsOperations(this); + ServiceFabricSchedules = new ServiceFabricSchedulesOperations(this); + VirtualMachines = new VirtualMachinesOperations(this); + VirtualMachineSchedules = new VirtualMachineSchedulesOperations(this); + VirtualNetworks = new VirtualNetworksOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2018-09-15"; + 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs new file mode 100644 index 000000000000..1f6e18917d74 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs @@ -0,0 +1,1875 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// 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(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List disks in a given user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("userName", userName); + 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.DevTestLab/labs/{labName}/users/{userName}/disks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, disk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, DiskFragment 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (disk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "disk"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("disk", disk); + 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.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task AttachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginAttachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, attachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DetachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDetachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, detachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (disk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "disk"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// 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 BeginAttachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (attachDiskProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "attachDiskProperties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("attachDiskProperties", attachDiskProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginAttach", 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.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(attachDiskProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(attachDiskProperties, 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); + } + System.Net.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; + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// 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 BeginDetachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (detachDiskProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "detachDiskProperties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("detachDiskProperties", detachDiskProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDetach", 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.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(detachDiskProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(detachDiskProperties, 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); + } + System.Net.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; + } + + /// + /// List disks in a given user profile. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs new file mode 100644 index 000000000000..f2e41ff0a3ca --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs @@ -0,0 +1,674 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DisksOperations. + /// + public static partial class DisksOperationsExtensions + { + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IDisksOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, userName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + public static Disk Get(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, userName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + public static Disk CreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, Disk disk) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, name, disk).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void Delete(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + public static Disk Update(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DiskFragment disk) + { + return operations.UpdateAsync(resourceGroupName, labName, userName, name, disk).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DiskFragment disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + public static void Attach(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + { + operations.AttachAsync(resourceGroupName, labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// The cancellation token. + /// + public static async Task AttachAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AttachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + public static void Detach(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + { + operations.DetachAsync(resourceGroupName, labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// The cancellation token. + /// + public static async Task DetachAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DetachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, Disk disk) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, userName, name, disk).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void BeginDelete(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + public static void BeginAttach(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + { + operations.BeginAttachAsync(resourceGroupName, labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// The cancellation token. + /// + public static async Task BeginAttachAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginAttachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + public static void BeginDetach(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + { + operations.BeginDetachAsync(resourceGroupName, labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDetachAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDetachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List disks in a given user profile. + /// + /// + /// 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(); + } + + /// + /// List disks in a given user profile. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs new file mode 100644 index 000000000000..3febf1fb06d9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs @@ -0,0 +1,1396 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// EnvironmentsOperations operations. + /// + internal partial class EnvironmentsOperations : IServiceOperations, IEnvironmentsOperations + { + /// + /// Initializes a new instance of the EnvironmentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EnvironmentsOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List environments in a given user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("userName", userName); + 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.DevTestLab/labs/{labName}/users/{userName}/environments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 environment. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, dtlEnvironment, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of environments. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, DtlEnvironmentFragment dtlEnvironment, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (dtlEnvironment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dtlEnvironment"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("dtlEnvironment", dtlEnvironment); + 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.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(dtlEnvironment != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dtlEnvironment, 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); + } + System.Net.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 replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, DtlEnvironment dtlEnvironment, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (dtlEnvironment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dtlEnvironment"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("dtlEnvironment", dtlEnvironment); + 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.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(dtlEnvironment != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dtlEnvironment, 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); + } + System.Net.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; + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 environments in a given user profile. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs new file mode 100644 index 000000000000..9869ea3e9494 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs @@ -0,0 +1,448 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EnvironmentsOperations. + /// + public static partial class EnvironmentsOperationsExtensions + { + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, userName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get environment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + public static DtlEnvironment Get(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, userName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get environment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static void Delete(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of environments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + public static DtlEnvironment Update(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironmentFragment dtlEnvironment) + { + return operations.UpdateAsync(resourceGroupName, labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of environments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironmentFragment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static void BeginDelete(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IEnvironmentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List environments in a given user profile. + /// + /// + /// 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 IEnvironmentsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs new file mode 100644 index 000000000000..71ca5c312cf1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs @@ -0,0 +1,1319 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// FormulasOperations operations. + /// + internal partial class FormulasOperations : IServiceOperations, IFormulasOperations + { + /// + /// Initializes a new instance of the FormulasOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FormulasOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List formulas in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/formulas").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 formula. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/formulas/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, formula, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete formula. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/formulas/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of formulas. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, FormulaFragment formula, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (formula == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "formula"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("formula", formula); + 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.DevTestLab/labs/{labName}/formulas/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(formula != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(formula, 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); + } + System.Net.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 replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, Formula formula, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (formula == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "formula"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("formula", formula); + 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.DevTestLab/labs/{labName}/formulas/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(formula != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(formula, 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); + } + System.Net.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; + } + + /// + /// List formulas in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs new file mode 100644 index 000000000000..ff69f07d4986 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FormulasOperations. + /// + public static partial class FormulasOperationsExtensions + { + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IFormulasOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IFormulasOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + public static Formula Get(this IFormulasOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + public static Formula CreateOrUpdate(this IFormulasOperations operations, string resourceGroupName, string labName, string name, Formula formula) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, formula).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, Formula formula, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, formula, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + public static void Delete(this IFormulasOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of formulas. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + public static Formula Update(this IFormulasOperations operations, string resourceGroupName, string labName, string name, FormulaFragment formula) + { + return operations.UpdateAsync(resourceGroupName, labName, name, formula).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of formulas. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, FormulaFragment formula, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, formula, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + public static Formula BeginCreateOrUpdate(this IFormulasOperations operations, string resourceGroupName, string labName, string name, Formula formula) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, formula).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, Formula formula, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, formula, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IFormulasOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List formulas in a given lab. + /// + /// + /// 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 IFormulasOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs new file mode 100644 index 000000000000..3f528983dcb4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs @@ -0,0 +1,436 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// 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(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List gallery images in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/galleryimages").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 gallery images in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs new file mode 100644 index 000000000000..85502f30dd75 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GalleryImagesOperations. + /// + public static partial class GalleryImagesOperationsExtensions + { + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IGalleryImagesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IGalleryImagesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IGalleryImagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery images in a given lab. + /// + /// + /// 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 IGalleryImagesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs new file mode 100644 index 000000000000..809227bb70c6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs @@ -0,0 +1,2020 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// GlobalSchedulesOperations operations. + /// + internal partial class GlobalSchedulesOperations : IServiceOperations, IGlobalSchedulesOperations + { + /// + /// Initializes a new instance of the GlobalSchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GlobalSchedulesOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List schedules in a subscription. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + 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.DevTestLab/schedules").ToString(); + _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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 schedules in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("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.DevTestLab/schedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + 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.DevTestLab/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 name, Schedule schedule, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + 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.DevTestLab/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(schedule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); + } + System.Net.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; + } + + /// + /// Delete schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + 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.DevTestLab/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of schedules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 name, ScheduleFragment schedule, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + 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.DevTestLab/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(schedule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); + } + System.Net.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; + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(resourceGroupName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RetargetWithHttpMessagesAsync(string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRetargetWithHttpMessagesAsync(resourceGroupName, name, retargetScheduleProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", 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.DevTestLab/schedules/{name}/execute").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// 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 BeginRetargetWithHttpMessagesAsync(string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (retargetScheduleProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "retargetScheduleProperties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("retargetScheduleProperties", retargetScheduleProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRetarget", 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.DevTestLab/schedules/{name}/retarget").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(retargetScheduleProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(retargetScheduleProperties, 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); + } + System.Net.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; + } + + /// + /// List schedules 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); + } + System.Net.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 schedules 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..789917f7b6dd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GlobalSchedulesOperations. + /// + public static partial class GlobalSchedulesOperationsExtensions + { + /// + /// List schedules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListBySubscription(this IGlobalSchedulesOperations operations, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IGlobalSchedulesOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List schedules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByResourceGroup(this IGlobalSchedulesOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, Schedule schedule) + { + return operations.CreateOrUpdateAsync(resourceGroupName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this IGlobalSchedulesOperations operations, string resourceGroupName, string name) + { + operations.DeleteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + public static Schedule Update(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, ScheduleFragment schedule) + { + return operations.UpdateAsync(resourceGroupName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this IGlobalSchedulesOperations operations, string resourceGroupName, string name) + { + operations.ExecuteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + public static void Retarget(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties) + { + operations.RetargetAsync(resourceGroupName, name, retargetScheduleProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// The cancellation token. + /// + public static async Task RetargetAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RetargetWithHttpMessagesAsync(resourceGroupName, name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this IGlobalSchedulesOperations operations, string resourceGroupName, string name) + { + operations.BeginExecuteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExecuteAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + public static void BeginRetarget(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties) + { + operations.BeginRetargetAsync(resourceGroupName, name, retargetScheduleProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRetargetAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRetargetWithHttpMessagesAsync(resourceGroupName, name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List schedules 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 IGlobalSchedulesOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules 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 IGlobalSchedulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List schedules 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 IGlobalSchedulesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules 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 IGlobalSchedulesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs new file mode 100644 index 000000000000..824bc0c14050 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.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.DevTestLabs +{ + 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; + + /// + /// ArmTemplatesOperations operations. + /// + public partial interface IArmTemplatesOperations + { + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get azure resource manager template. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=displayName)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs new file mode 100644 index 000000000000..466cb9703b0f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.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.DevTestLabs +{ + 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; + + /// + /// ArtifactSourcesOperations operations. + /// + public partial interface IArtifactSourcesOperations + { + /// + /// List artifact sources in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=displayName)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, ArtifactSource artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of artifact sources. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, ArtifactSourceFragment artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List artifact sources in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs new file mode 100644 index 000000000000..c32e03633389 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.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.DevTestLabs +{ + 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; + + /// + /// ArtifactsOperations operations. + /// + public partial interface IArtifactsOperations + { + /// + /// List artifacts in a given artifact source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get artifact. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Generates an ARM template for the given artifact, uploads the + /// required files to a storage account, and validates the generated + /// artifact. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GenerateArmTemplateWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List artifacts in a given artifact source. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs new file mode 100644 index 000000000000..ba5361f47180 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CostsOperations operations. + /// + public partial interface ICostsOperations + { + /// + /// Get cost. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=labCostDetails)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing cost. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// A cost item. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, LabCost labCost, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs new file mode 100644 index 000000000000..fb56f74f7a86 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.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.DevTestLabs +{ + 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; + + /// + /// CustomImagesOperations operations. + /// + public partial interface ICustomImagesOperations + { + /// + /// List custom images in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get custom image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing custom image. This operation can take + /// a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of custom images. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, CustomImageFragment customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing custom image. This operation can take + /// a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List custom images in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs new file mode 100644 index 000000000000..ae1ff0889dc8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// The DevTest Labs Client. + /// + public partial interface IDevTestLabsClient : 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; } + + /// + /// Client API version. + /// + string ApiVersion { get; } + + /// + /// The subscription ID. + /// + 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 IProviderOperations. + /// + IProviderOperations ProviderOperations { get; } + + /// + /// Gets the ILabsOperations. + /// + ILabsOperations Labs { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IGlobalSchedulesOperations. + /// + IGlobalSchedulesOperations GlobalSchedules { get; } + + /// + /// Gets the IArtifactSourcesOperations. + /// + IArtifactSourcesOperations ArtifactSources { get; } + + /// + /// Gets the IArmTemplatesOperations. + /// + IArmTemplatesOperations ArmTemplates { get; } + + /// + /// Gets the IArtifactsOperations. + /// + IArtifactsOperations Artifacts { get; } + + /// + /// Gets the ICostsOperations. + /// + ICostsOperations Costs { get; } + + /// + /// Gets the ICustomImagesOperations. + /// + ICustomImagesOperations CustomImages { get; } + + /// + /// Gets the IFormulasOperations. + /// + IFormulasOperations Formulas { get; } + + /// + /// Gets the IGalleryImagesOperations. + /// + IGalleryImagesOperations GalleryImages { get; } + + /// + /// Gets the INotificationChannelsOperations. + /// + INotificationChannelsOperations NotificationChannels { get; } + + /// + /// Gets the IPolicySetsOperations. + /// + IPolicySetsOperations PolicySets { get; } + + /// + /// Gets the IPoliciesOperations. + /// + IPoliciesOperations Policies { get; } + + /// + /// Gets the ISchedulesOperations. + /// + ISchedulesOperations Schedules { get; } + + /// + /// Gets the IServiceRunnersOperations. + /// + IServiceRunnersOperations ServiceRunners { get; } + + /// + /// Gets the IUsersOperations. + /// + IUsersOperations Users { get; } + + /// + /// Gets the IDisksOperations. + /// + IDisksOperations Disks { get; } + + /// + /// Gets the IEnvironmentsOperations. + /// + IEnvironmentsOperations Environments { get; } + + /// + /// Gets the ISecretsOperations. + /// + ISecretsOperations Secrets { get; } + + /// + /// Gets the IServiceFabricsOperations. + /// + IServiceFabricsOperations ServiceFabrics { get; } + + /// + /// Gets the IServiceFabricSchedulesOperations. + /// + IServiceFabricSchedulesOperations ServiceFabricSchedules { get; } + + /// + /// Gets the IVirtualMachinesOperations. + /// + IVirtualMachinesOperations VirtualMachines { get; } + + /// + /// Gets the IVirtualMachineSchedulesOperations. + /// + IVirtualMachineSchedulesOperations VirtualMachineSchedules { get; } + + /// + /// Gets the IVirtualNetworksOperations. + /// + IVirtualNetworksOperations VirtualNetworks { get; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs new file mode 100644 index 000000000000..52f70aa1a237 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs @@ -0,0 +1,403 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// DisksOperations operations. + /// + public partial interface IDisksOperations + { + /// + /// List disks in a given user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing disk. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, DiskFragment disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Attach and create the lease of the disk to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// 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 AttachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Detach and break the lease of the disk attached to the virtual + /// machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// 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 DetachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing disk. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Attach and create the lease of the disk to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// 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 BeginAttachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Detach and break the lease of the disk attached to the virtual + /// machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// 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 BeginDetachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List disks in a given user profile. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs new file mode 100644 index 000000000000..28d2384aa0bb --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs @@ -0,0 +1,276 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// EnvironmentsOperations operations. + /// + public partial interface IEnvironmentsOperations + { + /// + /// List environments in a given user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get environment. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing environment. This operation can take + /// a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of environments. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, DtlEnvironmentFragment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing environment. This operation can take + /// a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List environments in a given user profile. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs new file mode 100644 index 000000000000..48864015c4dd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs @@ -0,0 +1,233 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// FormulasOperations operations. + /// + public partial interface IFormulasOperations + { + /// + /// List formulas in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get formula. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=description)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing Formula. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other + /// parameters + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete formula. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of formulas. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other + /// parameters + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, FormulaFragment formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing Formula. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other + /// parameters + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List formulas in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs new file mode 100644 index 000000000000..aaf883380f59 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.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.DevTestLabs +{ + 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; + + /// + /// GalleryImagesOperations operations. + /// + public partial interface IGalleryImagesOperations + { + /// + /// List gallery images in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery images in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs new file mode 100644 index 000000000000..dd2c73fc409b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.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.DevTestLabs +{ + 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; + + /// + /// GlobalSchedulesOperations operations. + /// + public partial interface IGlobalSchedulesOperations + { + /// + /// List schedules in a subscription. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List schedules in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of schedules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 ExecuteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a schedule's target resource Id. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// 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 RetargetWithHttpMessagesAsync(string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a schedule's target resource Id. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// 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 BeginRetargetWithHttpMessagesAsync(string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List schedules 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)); + /// + /// List schedules 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs new file mode 100644 index 000000000000..5caa37c63a5e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs @@ -0,0 +1,557 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// LabsOperations operations. + /// + public partial interface ILabsOperations + { + /// + /// List labs in a subscription. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List labs in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing lab. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of labs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 name, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Claim a random claimable virtual machine in the lab. This operation + /// can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 ClaimAnyVmWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create virtual machines in a lab. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a 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 CreateEnvironmentWithHttpMessagesAsync(string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Exports the lab resource usage into a storage account This + /// operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export 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 ExportResourceUsageWithHttpMessagesAsync(string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for generating an upload URI. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GenerateUploadUriWithHttpMessagesAsync(string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Import a virtual machine into a different lab. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// This represents the payload required to import a virtual machine + /// from a different lab into the current one + /// + /// + /// 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 ImportVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List disk images available for custom image creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListVhdsWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing lab. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Claim a random claimable virtual machine in the lab. This operation + /// can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginClaimAnyVmWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create virtual machines in a lab. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a 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 BeginCreateEnvironmentWithHttpMessagesAsync(string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Exports the lab resource usage into a storage account This + /// operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export 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 BeginExportResourceUsageWithHttpMessagesAsync(string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Import a virtual machine into a different lab. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// This represents the payload required to import a virtual machine + /// from a different lab into the current one + /// + /// + /// 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 BeginImportVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List labs 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)); + /// + /// List labs 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)); + /// + /// List disk images available for custom image creation. + /// + /// + /// 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>> ListVhdsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs new file mode 100644 index 000000000000..b4b8dc3d17de --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.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.DevTestLabs +{ + 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; + + /// + /// NotificationChannelsOperations operations. + /// + public partial interface INotificationChannelsOperations + { + /// + /// List notificationchannels in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get notificationchannel. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=webHookUrl)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, NotificationChannel notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete notificationchannel. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of notificationchannels. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, NotificationChannelFragment notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Send notification to provided channel. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Properties for generating a Notification. + /// + /// + /// 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 NotifyWithHttpMessagesAsync(string resourceGroupName, string labName, string name, NotifyParameters notifyParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List notificationchannels in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs new file mode 100644 index 000000000000..938e9b9640ad --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.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.DevTestLabs +{ + 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 + { + /// + /// Get operation. + /// + /// + /// The name of the location. + /// + /// + /// The name of 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 locationName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs new file mode 100644 index 000000000000..49cc0746565d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.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.DevTestLabs +{ + 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; + + /// + /// PoliciesOperations operations. + /// + public partial interface IPoliciesOperations + { + /// + /// List policies in a given policy set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=description)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string policySetName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string policySetName, string name, Policy policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// 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 labName, string policySetName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of policies. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string policySetName, string name, PolicyFragment policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List policies in a given policy 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs new file mode 100644 index 000000000000..2edc6e6b823b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PolicySetsOperations operations. + /// + public partial interface IPolicySetsOperations + { + /// + /// Evaluates lab policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// Request body for evaluating a policy 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> EvaluatePoliciesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs new file mode 100644 index 000000000000..4f9ea196066a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProviderOperations operations. + /// + public partial interface IProviderOperations + { + /// + /// Result of the request to list REST API 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)); + /// + /// Result of the request to list REST API operations + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs new file mode 100644 index 000000000000..00111fe801a7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.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.DevTestLabs +{ + 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; + + /// + /// SchedulesOperations operations. + /// + public partial interface ISchedulesOperations + { + /// + /// List schedules in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of schedules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all applicable schedules + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListApplicableWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List schedules in a given lab. + /// + /// + /// 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 applicable schedules + /// + /// + /// 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>> ListApplicableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs new file mode 100644 index 000000000000..ca5de78577c7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.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.DevTestLabs +{ + 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; + + /// + /// SecretsOperations operations. + /// + public partial interface ISecretsOperations + { + /// + /// List secrets in a given user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get secret. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing secret. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete secret. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of secrets. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, SecretFragment secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing secret. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List secrets in a given user profile. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricSchedulesOperations.cs new file mode 100644 index 000000000000..9f3da080eeca --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricSchedulesOperations.cs @@ -0,0 +1,288 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// ServiceFabricSchedulesOperations operations. + /// + public partial interface IServiceFabricSchedulesOperations + { + /// + /// List schedules in a given service fabric. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string serviceFabricName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string serviceFabricName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 labName, string userName, string serviceFabricName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of schedules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string serviceFabricName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List schedules in a given service fabric. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricsOperations.cs new file mode 100644 index 000000000000..01b54afaa2d9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricsOperations.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.DevTestLabs +{ + 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; + + /// + /// ServiceFabricsOperations operations. + /// + public partial interface IServiceFabricsOperations + { + /// + /// List service fabrics in a given user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get service fabric. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=applicableSchedule)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing Service Fabric. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, ServiceFabric serviceFabric, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete service fabric. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of service fabrics. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, ServiceFabricFragment serviceFabric, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the applicable start/stop schedules, if any. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start a service fabric. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop a service fabric This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 StopWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing Service Fabric. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string userName, string name, ServiceFabric serviceFabric, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete service fabric. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start a service fabric. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop a service fabric This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List service fabrics in a given user profile. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs new file mode 100644 index 000000000000..c05412a2c44d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs @@ -0,0 +1,162 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// ServiceRunnersOperations operations. + /// + public partial interface IServiceRunnersOperations + { + /// + /// List service runners in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get service runner. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing Service runner. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// A container for a managed identity to execute DevTest lab 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ServiceRunner serviceRunner, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete service runner. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List service runners in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs new file mode 100644 index 000000000000..376f9a3b7e26 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.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.DevTestLabs +{ + 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; + + /// + /// UsersOperations operations. + /// + public partial interface IUsersOperations + { + /// + /// List user profiles in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing user profile. This operation can take + /// a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of user profiles. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing user profile. This operation can take + /// a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List user profiles in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs new file mode 100644 index 000000000000..8976e2e36d0b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs @@ -0,0 +1,267 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// VirtualMachineSchedulesOperations operations. + /// + public partial interface IVirtualMachineSchedulesOperations + { + /// + /// List schedules in a given virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string virtualMachineName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string virtualMachineName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of schedules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string virtualMachineName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List schedules in a given 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs new file mode 100644 index 000000000000..495a0cbcbbe6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs @@ -0,0 +1,912 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// VirtualMachinesOperations operations. + /// + public partial interface IVirtualMachinesOperations + { + /// + /// List virtual machines in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing Virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of virtual machines. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Attach a new or existing data disk to virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a 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 AddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Apply artifacts to virtual machine. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a 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 ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Take ownership of an existing virtual machine This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 ClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Detach the specified disk from the virtual machine. This operation + /// can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a 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 DetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a string that represents the contents of the RDP file for the + /// virtual machine + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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> GetRdpFileContentsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the applicable start/stop schedules, if any. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Redeploy a virtual machine This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Resize Virtual Machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for resizing a 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 ResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restart a virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start a virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 StopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Transfers all data disks attached to the virtual machine to be + /// owned by the current user. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 TransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Release ownership of an existing virtual machine This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 UnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing Virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Attach a new or existing data disk to virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a 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 BeginAddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Apply artifacts to virtual machine. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a 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 BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Take ownership of an existing virtual machine This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Detach the specified disk from the virtual machine. This operation + /// can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a 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 BeginDetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Redeploy a virtual machine This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Resize Virtual Machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for resizing a 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 BeginResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restart a virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start a virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Transfers all data disks attached to the virtual machine to be + /// owned by the current user. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginTransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Release ownership of an existing virtual machine This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginUnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List virtual machines in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs new file mode 100644 index 000000000000..8a24a0dd1996 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs @@ -0,0 +1,257 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// VirtualNetworksOperations operations. + /// + public partial interface IVirtualNetworksOperations + { + /// + /// List virtual networks in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get virtual network. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=externalSubnets)' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing virtual network. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete virtual network. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Modify properties of virtual networks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, VirtualNetworkFragment virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or replace an existing virtual network. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete virtual network. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List virtual networks in a given lab. + /// + /// + /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs new file mode 100644 index 000000000000..6eae66d5ed00 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs @@ -0,0 +1,3085 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// LabsOperations operations. + /// + internal partial class LabsOperations : IServiceOperations, ILabsOperations + { + /// + /// Initializes a new instance of the LabsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LabsOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List labs in a subscription. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + 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.DevTestLab/labs").ToString(); + _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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 labs in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("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.DevTestLab/labs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, lab, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of labs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 name, LabFragment lab, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (lab == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "lab"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("lab", lab); + 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.DevTestLab/labs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(lab != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(lab, 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); + } + System.Net.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; + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ClaimAnyVmWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginClaimAnyVmWithHttpMessagesAsync(resourceGroupName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CreateEnvironmentWithHttpMessagesAsync(string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateEnvironmentWithHttpMessagesAsync(resourceGroupName, name, labVirtualMachineCreationParameter, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ExportResourceUsageWithHttpMessagesAsync(string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExportResourceUsageWithHttpMessagesAsync(resourceGroupName, name, exportResourceUsageParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for generating an upload URI. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GenerateUploadUriWithHttpMessagesAsync(string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (generateUploadUriParameter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "generateUploadUriParameter"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("generateUploadUriParameter", generateUploadUriParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GenerateUploadUri", 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.DevTestLab/labs/{name}/generateUploadUri").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(generateUploadUriParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(generateUploadUriParameter, 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); + } + System.Net.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; + } + + /// + /// Import a virtual machine into a different lab. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// This represents the payload required to import a virtual machine from a + /// different lab into the current one + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ImportVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginImportVirtualMachineWithHttpMessagesAsync(resourceGroupName, name, importLabVirtualMachineRequest, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListVhdsWithHttpMessagesAsync(string resourceGroupName, string name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListVhds", 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.DevTestLab/labs/{name}/listVhds").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 name, Lab lab, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (lab == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "lab"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("lab", lab); + 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.DevTestLab/labs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(lab != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(lab, 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); + } + System.Net.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; + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginClaimAnyVmWithHttpMessagesAsync(string resourceGroupName, string name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginClaimAnyVm", 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.DevTestLab/labs/{name}/claimAnyVm").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a 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 BeginCreateEnvironmentWithHttpMessagesAsync(string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (labVirtualMachineCreationParameter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labVirtualMachineCreationParameter"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("labVirtualMachineCreationParameter", labVirtualMachineCreationParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateEnvironment", 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.DevTestLab/labs/{name}/createEnvironment").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(labVirtualMachineCreationParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachineCreationParameter, 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); + } + System.Net.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; + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export 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 BeginExportResourceUsageWithHttpMessagesAsync(string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (exportResourceUsageParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportResourceUsageParameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("exportResourceUsageParameters", exportResourceUsageParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExportResourceUsage", 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.DevTestLab/labs/{name}/exportResourceUsage").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(exportResourceUsageParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(exportResourceUsageParameters, 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); + } + System.Net.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; + } + + /// + /// Import a virtual machine into a different lab. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// This represents the payload required to import a virtual machine from a + /// different lab into the current one + /// + /// + /// 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 BeginImportVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (importLabVirtualMachineRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "importLabVirtualMachineRequest"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("importLabVirtualMachineRequest", importLabVirtualMachineRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginImportVirtualMachine", 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.DevTestLab/labs/{name}/importVirtualMachine").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(importLabVirtualMachineRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(importLabVirtualMachineRequest, 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); + } + System.Net.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; + } + + /// + /// List labs 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); + } + System.Net.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 labs 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); + } + System.Net.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 disk images available for custom image creation. + /// + /// + /// 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>> ListVhdsNextWithHttpMessagesAsync(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, "ListVhdsNext", 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("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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs new file mode 100644 index 000000000000..b3a79f39d9f2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs @@ -0,0 +1,904 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LabsOperations. + /// + public static partial class LabsOperationsExtensions + { + /// + /// List labs in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListBySubscription(this ILabsOperations operations, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List labs in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this ILabsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List labs in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByResourceGroup(this ILabsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List labs in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ILabsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + public static Lab Get(this ILabsOperations operations, string resourceGroupName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILabsOperations operations, string resourceGroupName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + public static Lab CreateOrUpdate(this ILabsOperations operations, string resourceGroupName, string name, Lab lab) + { + return operations.CreateOrUpdateAsync(resourceGroupName, name, lab).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ILabsOperations operations, string resourceGroupName, string name, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + public static void Delete(this ILabsOperations operations, string resourceGroupName, string name) + { + operations.DeleteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of labs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + public static Lab Update(this ILabsOperations operations, string resourceGroupName, string name, LabFragment lab) + { + return operations.UpdateAsync(resourceGroupName, name, lab).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of labs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ILabsOperations operations, string resourceGroupName, string name, LabFragment lab, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + public static void ClaimAnyVm(this ILabsOperations operations, string resourceGroupName, string name) + { + operations.ClaimAnyVmAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async Task ClaimAnyVmAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ClaimAnyVmWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + public static void CreateEnvironment(this ILabsOperations operations, string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) + { + operations.CreateEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task CreateEnvironmentAsync(this ILabsOperations operations, string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CreateEnvironmentWithHttpMessagesAsync(resourceGroupName, name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + public static void ExportResourceUsage(this ILabsOperations operations, string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters) + { + operations.ExportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters).GetAwaiter().GetResult(); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + /// + /// The cancellation token. + /// + public static async Task ExportResourceUsageAsync(this ILabsOperations operations, string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ExportResourceUsageWithHttpMessagesAsync(resourceGroupName, name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for generating an upload URI. + /// + public static GenerateUploadUriResponse GenerateUploadUri(this ILabsOperations operations, string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter) + { + return operations.GenerateUploadUriAsync(resourceGroupName, name, generateUploadUriParameter).GetAwaiter().GetResult(); + } + + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for generating an upload URI. + /// + /// + /// The cancellation token. + /// + public static async Task GenerateUploadUriAsync(this ILabsOperations operations, string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateUploadUriWithHttpMessagesAsync(resourceGroupName, name, generateUploadUriParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Import a virtual machine into a different lab. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// This represents the payload required to import a virtual machine from a + /// different lab into the current one + /// + public static void ImportVirtualMachine(this ILabsOperations operations, string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) + { + operations.ImportVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest).GetAwaiter().GetResult(); + } + + /// + /// Import a virtual machine into a different lab. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// This represents the payload required to import a virtual machine from a + /// different lab into the current one + /// + /// + /// The cancellation token. + /// + public static async Task ImportVirtualMachineAsync(this ILabsOperations operations, string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ImportVirtualMachineWithHttpMessagesAsync(resourceGroupName, name, importLabVirtualMachineRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + public static IPage ListVhds(this ILabsOperations operations, string resourceGroupName, string name) + { + return operations.ListVhdsAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async Task> ListVhdsAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVhdsWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string resourceGroupName, string name, Lab lab) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, name, lab).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ILabsOperations operations, string resourceGroupName, string name, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + public static void BeginDelete(this ILabsOperations operations, string resourceGroupName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + public static void BeginClaimAnyVm(this ILabsOperations operations, string resourceGroupName, string name) + { + operations.BeginClaimAnyVmAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async Task BeginClaimAnyVmAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginClaimAnyVmWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + public static void BeginCreateEnvironment(this ILabsOperations operations, string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) + { + operations.BeginCreateEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateEnvironmentAsync(this ILabsOperations operations, string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCreateEnvironmentWithHttpMessagesAsync(resourceGroupName, name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + public static void BeginExportResourceUsage(this ILabsOperations operations, string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters) + { + operations.BeginExportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters).GetAwaiter().GetResult(); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExportResourceUsageAsync(this ILabsOperations operations, string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginExportResourceUsageWithHttpMessagesAsync(resourceGroupName, name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Import a virtual machine into a different lab. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// This represents the payload required to import a virtual machine from a + /// different lab into the current one + /// + public static void BeginImportVirtualMachine(this ILabsOperations operations, string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) + { + operations.BeginImportVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest).GetAwaiter().GetResult(); + } + + /// + /// Import a virtual machine into a different lab. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// This represents the payload required to import a virtual machine from a + /// different lab into the current one + /// + /// + /// The cancellation token. + /// + public static async Task BeginImportVirtualMachineAsync(this ILabsOperations operations, string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginImportVirtualMachineWithHttpMessagesAsync(resourceGroupName, name, importLabVirtualMachineRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List labs 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 ILabsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List labs 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 ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List labs 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 ILabsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List labs 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 ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListVhdsNext(this ILabsOperations operations, string nextPageLink) + { + return operations.ListVhdsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListVhdsNextAsync(this ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVhdsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs new file mode 100644 index 000000000000..c8b5d196a75e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Schedules applicable to a virtual machine. The schedules may have been + /// defined on a VM or on lab level. + /// + [Rest.Serialization.JsonTransformation] + public partial class ApplicableSchedule : Resource + { + /// + /// Initializes a new instance of the ApplicableSchedule class. + /// + public ApplicableSchedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicableSchedule class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The auto-shutdown schedule, if one has + /// been set at the lab or lab resource level. + /// The auto-startup schedule, if one has + /// been set at the lab or lab resource level. + public ApplicableSchedule(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), Schedule labVmsShutdown = default(Schedule), Schedule labVmsStartup = default(Schedule)) + : base(id, name, type, location, tags) + { + LabVmsShutdown = labVmsShutdown; + LabVmsStartup = labVmsStartup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the auto-shutdown schedule, if one has been set at the + /// lab or lab resource level. + /// + [JsonProperty(PropertyName = "properties.labVmsShutdown")] + public Schedule LabVmsShutdown { get; set; } + + /// + /// Gets or sets the auto-startup schedule, if one has been set at the + /// lab or lab resource level. + /// + [JsonProperty(PropertyName = "properties.labVmsStartup")] + public Schedule LabVmsStartup { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs new file mode 100644 index 000000000000..e456a95130d5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Schedules applicable to a virtual machine. The schedules may have been + /// defined on a VM or on lab level. + /// + [Rest.Serialization.JsonTransformation] + public partial class ApplicableScheduleFragment : UpdateResource + { + /// + /// Initializes a new instance of the ApplicableScheduleFragment class. + /// + public ApplicableScheduleFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicableScheduleFragment class. + /// + /// The tags of the resource. + /// The auto-shutdown schedule, if one has + /// been set at the lab or lab resource level. + /// The auto-startup schedule, if one has + /// been set at the lab or lab resource level. + public ApplicableScheduleFragment(IDictionary tags = default(IDictionary), ScheduleFragment labVmsShutdown = default(ScheduleFragment), ScheduleFragment labVmsStartup = default(ScheduleFragment)) + : base(tags) + { + LabVmsShutdown = labVmsShutdown; + LabVmsStartup = labVmsStartup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the auto-shutdown schedule, if one has been set at the + /// lab or lab resource level. + /// + [JsonProperty(PropertyName = "properties.labVmsShutdown")] + public ScheduleFragment LabVmsShutdown { get; set; } + + /// + /// Gets or sets the auto-startup schedule, if one has been set at the + /// lab or lab resource level. + /// + [JsonProperty(PropertyName = "properties.labVmsStartup")] + public ScheduleFragment LabVmsStartup { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs new file mode 100644 index 000000000000..c82aca03f27c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Request body for applying artifacts to a virtual machine. + /// + public partial class ApplyArtifactsRequest + { + /// + /// Initializes a new instance of the ApplyArtifactsRequest class. + /// + public ApplyArtifactsRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplyArtifactsRequest class. + /// + /// The list of artifacts to apply. + public ApplyArtifactsRequest(IList artifacts = default(IList)) + { + Artifacts = artifacts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of artifacts to apply. + /// + [JsonProperty(PropertyName = "artifacts")] + public IList Artifacts { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs new file mode 100644 index 000000000000..2c7de5897125 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs @@ -0,0 +1,125 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Azure Resource Manager template. + /// + [Rest.Serialization.JsonTransformation] + public partial class ArmTemplate : Resource + { + /// + /// Initializes a new instance of the ArmTemplate class. + /// + public ArmTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmTemplate class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The display name of the ARM + /// template. + /// The description of the ARM + /// template. + /// The publisher of the ARM template. + /// The URI to the icon of the ARM template. + /// The contents of the ARM template. + /// The creation date of the + /// armTemplate. + /// File name and parameter + /// values information from all azuredeploy.*.parameters.json for the + /// ARM template. + /// Whether or not ARM template is enabled for + /// use by lab user. + public ArmTemplate(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string displayName = default(string), string description = default(string), string publisher = default(string), string icon = default(string), object contents = default(object), System.DateTime? createdDate = default(System.DateTime?), IList parametersValueFilesInfo = default(IList), bool? enabled = default(bool?)) + : base(id, name, type, location, tags) + { + DisplayName = displayName; + Description = description; + Publisher = publisher; + Icon = icon; + Contents = contents; + CreatedDate = createdDate; + ParametersValueFilesInfo = parametersValueFilesInfo; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the display name of the ARM template. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the description of the ARM template. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the publisher of the ARM template. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; private set; } + + /// + /// Gets the URI to the icon of the ARM template. + /// + [JsonProperty(PropertyName = "properties.icon")] + public string Icon { get; private set; } + + /// + /// Gets the contents of the ARM template. + /// + [JsonProperty(PropertyName = "properties.contents")] + public object Contents { get; private set; } + + /// + /// Gets the creation date of the armTemplate. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets file name and parameter values information from all + /// azuredeploy.*.parameters.json for the ARM template. + /// + [JsonProperty(PropertyName = "properties.parametersValueFilesInfo")] + public IList ParametersValueFilesInfo { get; private set; } + + /// + /// Gets whether or not ARM template is enabled for use by lab user. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs new file mode 100644 index 000000000000..4ebb200ef3f5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a generated ARM template. + /// + public partial class ArmTemplateInfo + { + /// + /// Initializes a new instance of the ArmTemplateInfo class. + /// + public ArmTemplateInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmTemplateInfo class. + /// + /// The template's contents. + /// The parameters of the ARM + /// template. + public ArmTemplateInfo(object template = default(object), object parameters = default(object)) + { + Template = template; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the template's contents. + /// + [JsonProperty(PropertyName = "template")] + public object Template { get; set; } + + /// + /// Gets or sets the parameters of the ARM template. + /// + [JsonProperty(PropertyName = "parameters")] + public object Parameters { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs new file mode 100644 index 000000000000..90cfd5cb7d46 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an Azure Resource Manager template parameter. + /// + public partial class ArmTemplateParameterProperties + { + /// + /// Initializes a new instance of the ArmTemplateParameterProperties + /// class. + /// + public ArmTemplateParameterProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmTemplateParameterProperties + /// class. + /// + /// The name of the template parameter. + /// The value of the template parameter. + public ArmTemplateParameterProperties(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 template parameter. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the template parameter. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterPropertiesFragment.cs new file mode 100644 index 000000000000..404902a83d4c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterPropertiesFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an Azure Resource Manager template parameter. + /// + public partial class ArmTemplateParameterPropertiesFragment + { + /// + /// Initializes a new instance of the + /// ArmTemplateParameterPropertiesFragment class. + /// + public ArmTemplateParameterPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ArmTemplateParameterPropertiesFragment class. + /// + /// The name of the template parameter. + /// The value of the template parameter. + public ArmTemplateParameterPropertiesFragment(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 template parameter. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the template parameter. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs new file mode 100644 index 000000000000..348308a7d0f9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An artifact. + /// + [Rest.Serialization.JsonTransformation] + public partial class Artifact : Resource + { + /// + /// Initializes a new instance of the Artifact class. + /// + public Artifact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Artifact class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The artifact's title. + /// The artifact's description. + /// The artifact's publisher. + /// The file path to the artifact. + /// The URI to the artifact icon. + /// The artifact's target OS. + /// The artifact's parameters. + /// The artifact's creation date. + public Artifact(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string title = default(string), string description = default(string), string publisher = default(string), string filePath = default(string), string icon = default(string), string targetOsType = default(string), object parameters = default(object), System.DateTime? createdDate = default(System.DateTime?)) + : base(id, name, type, location, tags) + { + Title = title; + Description = description; + Publisher = publisher; + FilePath = filePath; + Icon = icon; + TargetOsType = targetOsType; + Parameters = parameters; + CreatedDate = createdDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the artifact's title. + /// + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; private set; } + + /// + /// Gets the artifact's description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the artifact's publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; private set; } + + /// + /// Gets the file path to the artifact. + /// + [JsonProperty(PropertyName = "properties.filePath")] + public string FilePath { get; private set; } + + /// + /// Gets the URI to the artifact icon. + /// + [JsonProperty(PropertyName = "properties.icon")] + public string Icon { get; private set; } + + /// + /// Gets the artifact's target OS. + /// + [JsonProperty(PropertyName = "properties.targetOsType")] + public string TargetOsType { get; private set; } + + /// + /// Gets the artifact's parameters. + /// + [JsonProperty(PropertyName = "properties.parameters")] + public object Parameters { get; private set; } + + /// + /// Gets the artifact's creation date. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs new file mode 100644 index 000000000000..608decf38634 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an artifact deployment. + /// + public partial class ArtifactDeploymentStatusProperties + { + /// + /// Initializes a new instance of the + /// ArtifactDeploymentStatusProperties class. + /// + public ArtifactDeploymentStatusProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ArtifactDeploymentStatusProperties class. + /// + /// The deployment status of the + /// artifact. + /// The total count of the artifacts + /// that were successfully applied. + /// The total count of the artifacts that + /// were tentatively applied. + public ArtifactDeploymentStatusProperties(string deploymentStatus = default(string), int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) + { + DeploymentStatus = deploymentStatus; + ArtifactsApplied = artifactsApplied; + TotalArtifacts = totalArtifacts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the deployment status of the artifact. + /// + [JsonProperty(PropertyName = "deploymentStatus")] + public string DeploymentStatus { get; set; } + + /// + /// Gets or sets the total count of the artifacts that were + /// successfully applied. + /// + [JsonProperty(PropertyName = "artifactsApplied")] + public int? ArtifactsApplied { get; set; } + + /// + /// Gets or sets the total count of the artifacts that were tentatively + /// applied. + /// + [JsonProperty(PropertyName = "totalArtifacts")] + public int? TotalArtifacts { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs new file mode 100644 index 000000000000..6e4e03c72765 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an artifact deployment. + /// + public partial class ArtifactDeploymentStatusPropertiesFragment + { + /// + /// Initializes a new instance of the + /// ArtifactDeploymentStatusPropertiesFragment class. + /// + public ArtifactDeploymentStatusPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ArtifactDeploymentStatusPropertiesFragment class. + /// + /// The deployment status of the + /// artifact. + /// The total count of the artifacts + /// that were successfully applied. + /// The total count of the artifacts that + /// were tentatively applied. + public ArtifactDeploymentStatusPropertiesFragment(string deploymentStatus = default(string), int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) + { + DeploymentStatus = deploymentStatus; + ArtifactsApplied = artifactsApplied; + TotalArtifacts = totalArtifacts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the deployment status of the artifact. + /// + [JsonProperty(PropertyName = "deploymentStatus")] + public string DeploymentStatus { get; set; } + + /// + /// Gets or sets the total count of the artifacts that were + /// successfully applied. + /// + [JsonProperty(PropertyName = "artifactsApplied")] + public int? ArtifactsApplied { get; set; } + + /// + /// Gets or sets the total count of the artifacts that were tentatively + /// applied. + /// + [JsonProperty(PropertyName = "totalArtifacts")] + public int? TotalArtifacts { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs new file mode 100644 index 000000000000..cf274a8d7771 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of an artifact. + /// + public partial class ArtifactInstallProperties + { + /// + /// Initializes a new instance of the ArtifactInstallProperties class. + /// + public ArtifactInstallProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactInstallProperties class. + /// + /// The artifact's identifier. + /// The artifact's title. + /// The parameters of the artifact. + /// The status of the artifact. + /// The status message from the + /// deployment. + /// The status message from the + /// virtual machine extension. + /// The time that the artifact starts to + /// install on the virtual machine. + public ArtifactInstallProperties(string artifactId = default(string), string artifactTitle = default(string), IList parameters = default(IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + { + ArtifactId = artifactId; + ArtifactTitle = artifactTitle; + Parameters = parameters; + Status = status; + DeploymentStatusMessage = deploymentStatusMessage; + VmExtensionStatusMessage = vmExtensionStatusMessage; + InstallTime = installTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the artifact's identifier. + /// + [JsonProperty(PropertyName = "artifactId")] + public string ArtifactId { get; set; } + + /// + /// Gets or sets the artifact's title. + /// + [JsonProperty(PropertyName = "artifactTitle")] + public string ArtifactTitle { get; set; } + + /// + /// Gets or sets the parameters of the artifact. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Gets or sets the status of the artifact. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the status message from the deployment. + /// + [JsonProperty(PropertyName = "deploymentStatusMessage")] + public string DeploymentStatusMessage { get; set; } + + /// + /// Gets or sets the status message from the virtual machine extension. + /// + [JsonProperty(PropertyName = "vmExtensionStatusMessage")] + public string VmExtensionStatusMessage { get; set; } + + /// + /// Gets or sets the time that the artifact starts to install on the + /// virtual machine. + /// + [JsonProperty(PropertyName = "installTime")] + public System.DateTime? InstallTime { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs new file mode 100644 index 000000000000..8968c44e8fb3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of an artifact. + /// + public partial class ArtifactInstallPropertiesFragment + { + /// + /// Initializes a new instance of the ArtifactInstallPropertiesFragment + /// class. + /// + public ArtifactInstallPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactInstallPropertiesFragment + /// class. + /// + /// The artifact's identifier. + /// The artifact's title. + /// The parameters of the artifact. + /// The status of the artifact. + /// The status message from the + /// deployment. + /// The status message from the + /// virtual machine extension. + /// The time that the artifact starts to + /// install on the virtual machine. + public ArtifactInstallPropertiesFragment(string artifactId = default(string), string artifactTitle = default(string), IList parameters = default(IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + { + ArtifactId = artifactId; + ArtifactTitle = artifactTitle; + Parameters = parameters; + Status = status; + DeploymentStatusMessage = deploymentStatusMessage; + VmExtensionStatusMessage = vmExtensionStatusMessage; + InstallTime = installTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the artifact's identifier. + /// + [JsonProperty(PropertyName = "artifactId")] + public string ArtifactId { get; set; } + + /// + /// Gets or sets the artifact's title. + /// + [JsonProperty(PropertyName = "artifactTitle")] + public string ArtifactTitle { get; set; } + + /// + /// Gets or sets the parameters of the artifact. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Gets or sets the status of the artifact. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the status message from the deployment. + /// + [JsonProperty(PropertyName = "deploymentStatusMessage")] + public string DeploymentStatusMessage { get; set; } + + /// + /// Gets or sets the status message from the virtual machine extension. + /// + [JsonProperty(PropertyName = "vmExtensionStatusMessage")] + public string VmExtensionStatusMessage { get; set; } + + /// + /// Gets or sets the time that the artifact starts to install on the + /// virtual machine. + /// + [JsonProperty(PropertyName = "installTime")] + public System.DateTime? InstallTime { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs new file mode 100644 index 000000000000..1da54a237f25 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an artifact parameter. + /// + public partial class ArtifactParameterProperties + { + /// + /// Initializes a new instance of the ArtifactParameterProperties + /// class. + /// + public ArtifactParameterProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactParameterProperties + /// class. + /// + /// The name of the artifact parameter. + /// The value of the artifact parameter. + public ArtifactParameterProperties(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 artifact parameter. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the artifact parameter. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs new file mode 100644 index 000000000000..991965a21d01 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an artifact parameter. + /// + public partial class ArtifactParameterPropertiesFragment + { + /// + /// Initializes a new instance of the + /// ArtifactParameterPropertiesFragment class. + /// + public ArtifactParameterPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ArtifactParameterPropertiesFragment class. + /// + /// The name of the artifact parameter. + /// The value of the artifact parameter. + public ArtifactParameterPropertiesFragment(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 artifact parameter. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the artifact parameter. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs new file mode 100644 index 000000000000..85b0622e561a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs @@ -0,0 +1,156 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of an artifact source. + /// + [Rest.Serialization.JsonTransformation] + public partial class ArtifactSource : Resource + { + /// + /// Initializes a new instance of the ArtifactSource class. + /// + public ArtifactSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactSource class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The artifact source's display + /// name. + /// The artifact source's URI. + /// The artifact source's type. Possible + /// values include: 'VsoGit', 'GitHub' + /// The folder containing artifacts. + /// The folder containing Azure + /// Resource Manager templates. + /// The artifact source's branch + /// reference. + /// The security token to authenticate to + /// the artifact source. + /// Indicates if the artifact source is enabled + /// (values: Enabled, Disabled). Possible values include: 'Enabled', + /// 'Disabled' + /// The artifact source's creation + /// date. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public ArtifactSource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + DisplayName = displayName; + Uri = uri; + SourceType = sourceType; + FolderPath = folderPath; + ArmTemplateFolderPath = armTemplateFolderPath; + BranchRef = branchRef; + SecurityToken = securityToken; + Status = status; + CreatedDate = createdDate; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the artifact source's display name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the artifact source's URI. + /// + [JsonProperty(PropertyName = "properties.uri")] + public string Uri { get; set; } + + /// + /// Gets or sets the artifact source's type. Possible values include: + /// 'VsoGit', 'GitHub' + /// + [JsonProperty(PropertyName = "properties.sourceType")] + public string SourceType { get; set; } + + /// + /// Gets or sets the folder containing artifacts. + /// + [JsonProperty(PropertyName = "properties.folderPath")] + public string FolderPath { get; set; } + + /// + /// Gets or sets the folder containing Azure Resource Manager + /// templates. + /// + [JsonProperty(PropertyName = "properties.armTemplateFolderPath")] + public string ArmTemplateFolderPath { get; set; } + + /// + /// Gets or sets the artifact source's branch reference. + /// + [JsonProperty(PropertyName = "properties.branchRef")] + public string BranchRef { get; set; } + + /// + /// Gets or sets the security token to authenticate to the artifact + /// source. + /// + [JsonProperty(PropertyName = "properties.securityToken")] + public string SecurityToken { get; set; } + + /// + /// Gets or sets indicates if the artifact source is enabled (values: + /// Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets the artifact source's creation date. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs new file mode 100644 index 000000000000..4a7bd416782d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs @@ -0,0 +1,125 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of an artifact source. + /// + [Rest.Serialization.JsonTransformation] + public partial class ArtifactSourceFragment : UpdateResource + { + /// + /// Initializes a new instance of the ArtifactSourceFragment class. + /// + public ArtifactSourceFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactSourceFragment class. + /// + /// The tags of the resource. + /// The artifact source's display + /// name. + /// The artifact source's URI. + /// The artifact source's type. Possible + /// values include: 'VsoGit', 'GitHub' + /// The folder containing artifacts. + /// The folder containing Azure + /// Resource Manager templates. + /// The artifact source's branch + /// reference. + /// The security token to authenticate to + /// the artifact source. + /// Indicates if the artifact source is enabled + /// (values: Enabled, Disabled). Possible values include: 'Enabled', + /// 'Disabled' + public ArtifactSourceFragment(IDictionary tags = default(IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string)) + : base(tags) + { + DisplayName = displayName; + Uri = uri; + SourceType = sourceType; + FolderPath = folderPath; + ArmTemplateFolderPath = armTemplateFolderPath; + BranchRef = branchRef; + SecurityToken = securityToken; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the artifact source's display name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the artifact source's URI. + /// + [JsonProperty(PropertyName = "properties.uri")] + public string Uri { get; set; } + + /// + /// Gets or sets the artifact source's type. Possible values include: + /// 'VsoGit', 'GitHub' + /// + [JsonProperty(PropertyName = "properties.sourceType")] + public string SourceType { get; set; } + + /// + /// Gets or sets the folder containing artifacts. + /// + [JsonProperty(PropertyName = "properties.folderPath")] + public string FolderPath { get; set; } + + /// + /// Gets or sets the folder containing Azure Resource Manager + /// templates. + /// + [JsonProperty(PropertyName = "properties.armTemplateFolderPath")] + public string ArmTemplateFolderPath { get; set; } + + /// + /// Gets or sets the artifact source's branch reference. + /// + [JsonProperty(PropertyName = "properties.branchRef")] + public string BranchRef { get; set; } + + /// + /// Gets or sets the security token to authenticate to the artifact + /// source. + /// + [JsonProperty(PropertyName = "properties.securityToken")] + public string SecurityToken { get; set; } + + /// + /// Gets or sets indicates if the artifact source is enabled (values: + /// Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs new file mode 100644 index 000000000000..afc77e65e318 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the disk to attach. + /// + public partial class AttachDiskProperties + { + /// + /// Initializes a new instance of the AttachDiskProperties class. + /// + public AttachDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AttachDiskProperties class. + /// + /// The resource ID of the Lab virtual + /// machine to which the disk is attached. + public AttachDiskProperties(string leasedByLabVmId = default(string)) + { + LeasedByLabVmId = leasedByLabVmId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the Lab virtual machine to which + /// the disk is attached. + /// + [JsonProperty(PropertyName = "leasedByLabVmId")] + public string LeasedByLabVmId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs new file mode 100644 index 000000000000..f2e0d234a8b7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties to attach new disk to the Virtual Machine. + /// + public partial class AttachNewDataDiskOptions + { + /// + /// Initializes a new instance of the AttachNewDataDiskOptions class. + /// + public AttachNewDataDiskOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AttachNewDataDiskOptions class. + /// + /// Size of the disk to be attached in + /// GibiBytes. + /// The name of the disk to be attached. + /// The storage type for the disk (i.e. + /// Standard, Premium). Possible values include: 'Standard', + /// 'Premium' + public AttachNewDataDiskOptions(int? diskSizeGiB = default(int?), string diskName = default(string), string diskType = default(string)) + { + DiskSizeGiB = diskSizeGiB; + DiskName = diskName; + DiskType = diskType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets size of the disk to be attached in GibiBytes. + /// + [JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB { get; set; } + + /// + /// Gets or sets the name of the disk to be attached. + /// + [JsonProperty(PropertyName = "diskName")] + public string DiskName { get; set; } + + /// + /// Gets or sets the storage type for the disk (i.e. Standard, + /// Premium). Possible values include: 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "diskType")] + public string DiskType { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptionsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptionsFragment.cs new file mode 100644 index 000000000000..33926cf4fa1e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptionsFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties to attach new disk to the Virtual Machine. + /// + public partial class AttachNewDataDiskOptionsFragment + { + /// + /// Initializes a new instance of the AttachNewDataDiskOptionsFragment + /// class. + /// + public AttachNewDataDiskOptionsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AttachNewDataDiskOptionsFragment + /// class. + /// + /// Size of the disk to be attached in + /// GibiBytes. + /// The name of the disk to be attached. + /// The storage type for the disk (i.e. + /// Standard, Premium). Possible values include: 'Standard', + /// 'Premium' + public AttachNewDataDiskOptionsFragment(int? diskSizeGiB = default(int?), string diskName = default(string), string diskType = default(string)) + { + DiskSizeGiB = diskSizeGiB; + DiskName = diskName; + DiskType = diskType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets size of the disk to be attached in GibiBytes. + /// + [JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB { get; set; } + + /// + /// Gets or sets the name of the disk to be attached. + /// + [JsonProperty(PropertyName = "diskName")] + public string DiskName { get; set; } + + /// + /// Gets or sets the storage type for the disk (i.e. Standard, + /// Premium). Possible values include: 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "diskType")] + public string DiskType { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs new file mode 100644 index 000000000000..218660d8d138 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Parameters for creating multiple virtual machines as a single action. + /// + public partial class BulkCreationParameters + { + /// + /// Initializes a new instance of the BulkCreationParameters class. + /// + public BulkCreationParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BulkCreationParameters class. + /// + /// The number of virtual machine instances + /// to create. + public BulkCreationParameters(int? instanceCount = default(int?)) + { + InstanceCount = instanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of virtual machine instances to create. + /// + [JsonProperty(PropertyName = "instanceCount")] + public int? InstanceCount { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParametersFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParametersFragment.cs new file mode 100644 index 000000000000..77f9e4ef715d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParametersFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Parameters for creating multiple virtual machines as a single action. + /// + public partial class BulkCreationParametersFragment + { + /// + /// Initializes a new instance of the BulkCreationParametersFragment + /// class. + /// + public BulkCreationParametersFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BulkCreationParametersFragment + /// class. + /// + /// The number of virtual machine instances + /// to create. + public BulkCreationParametersFragment(int? instanceCount = default(int?)) + { + InstanceCount = instanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of virtual machine instances to create. + /// + [JsonProperty(PropertyName = "instanceCount")] + public int? InstanceCount { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs new file mode 100644 index 000000000000..f3f4872ee9e6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A data disks attached to a virtual machine. + /// + public partial class ComputeDataDisk + { + /// + /// Initializes a new instance of the ComputeDataDisk class. + /// + public ComputeDataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeDataDisk class. + /// + /// Gets data disk name. + /// When backed by a blob, the URI of underlying + /// blob. + /// When backed by managed disk, this is + /// the ID of the compute disk resource. + /// Gets data disk size in GiB. + public ComputeDataDisk(string name = default(string), string diskUri = default(string), string managedDiskId = default(string), int? diskSizeGiB = default(int?)) + { + Name = name; + DiskUri = diskUri; + ManagedDiskId = managedDiskId; + DiskSizeGiB = diskSizeGiB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets data disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [JsonProperty(PropertyName = "diskUri")] + public string DiskUri { get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the + /// compute disk resource. + /// + [JsonProperty(PropertyName = "managedDiskId")] + public string ManagedDiskId { get; set; } + + /// + /// Gets data disk size in GiB. + /// + [JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs new file mode 100644 index 000000000000..e027e1d58dc1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A data disks attached to a virtual machine. + /// + public partial class ComputeDataDiskFragment + { + /// + /// Initializes a new instance of the ComputeDataDiskFragment class. + /// + public ComputeDataDiskFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeDataDiskFragment class. + /// + /// Gets data disk name. + /// When backed by a blob, the URI of underlying + /// blob. + /// When backed by managed disk, this is + /// the ID of the compute disk resource. + /// Gets data disk size in GiB. + public ComputeDataDiskFragment(string name = default(string), string diskUri = default(string), string managedDiskId = default(string), int? diskSizeGiB = default(int?)) + { + Name = name; + DiskUri = diskUri; + ManagedDiskId = managedDiskId; + DiskSizeGiB = diskSizeGiB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets data disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [JsonProperty(PropertyName = "diskUri")] + public string DiskUri { get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the + /// compute disk resource. + /// + [JsonProperty(PropertyName = "managedDiskId")] + public string ManagedDiskId { get; set; } + + /// + /// Gets data disk size in GiB. + /// + [JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs new file mode 100644 index 000000000000..a35d64d423fa --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Status information about a virtual machine. + /// + public partial class ComputeVmInstanceViewStatus + { + /// + /// Initializes a new instance of the ComputeVmInstanceViewStatus + /// class. + /// + public ComputeVmInstanceViewStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeVmInstanceViewStatus + /// class. + /// + /// Gets the status Code. + /// Gets the short localizable label for + /// the status. + /// Gets the message associated with the + /// status. + public ComputeVmInstanceViewStatus(string code = default(string), string displayStatus = default(string), string message = default(string)) + { + Code = code; + DisplayStatus = displayStatus; + Message = message; + 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; set; } + + /// + /// Gets the short localizable label for the status. + /// + [JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus { get; set; } + + /// + /// Gets the message associated with the status. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs new file mode 100644 index 000000000000..bfebdc27f087 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Status information about a virtual machine. + /// + public partial class ComputeVmInstanceViewStatusFragment + { + /// + /// Initializes a new instance of the + /// ComputeVmInstanceViewStatusFragment class. + /// + public ComputeVmInstanceViewStatusFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ComputeVmInstanceViewStatusFragment class. + /// + /// Gets the status Code. + /// Gets the short localizable label for + /// the status. + /// Gets the message associated with the + /// status. + public ComputeVmInstanceViewStatusFragment(string code = default(string), string displayStatus = default(string), string message = default(string)) + { + Code = code; + DisplayStatus = displayStatus; + Message = message; + 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; set; } + + /// + /// Gets the short localizable label for the status. + /// + [JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus { get; set; } + + /// + /// Gets the message associated with the status. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs new file mode 100644 index 000000000000..70ea07a87f87 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a virtual machine returned by the Microsoft.Compute API. + /// + public partial class ComputeVmProperties + { + /// + /// Initializes a new instance of the ComputeVmProperties class. + /// + public ComputeVmProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeVmProperties class. + /// + /// Gets the statuses of the virtual + /// machine. + /// Gets the OS type of the virtual + /// machine. + /// Gets the size of the virtual machine. + /// Gets the network interface ID of + /// the virtual machine. + /// Gets OS disk blob uri for the virtual + /// machine. + /// Gets data disks blob uri for the virtual + /// machine. + /// Gets all data disks attached to the virtual + /// machine. + public ComputeVmProperties(IList statuses = default(IList), string osType = default(string), string vmSize = default(string), string networkInterfaceId = default(string), string osDiskId = default(string), IList dataDiskIds = default(IList), IList dataDisks = default(IList)) + { + Statuses = statuses; + OsType = osType; + VmSize = vmSize; + NetworkInterfaceId = networkInterfaceId; + OsDiskId = osDiskId; + DataDiskIds = dataDiskIds; + DataDisks = dataDisks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the statuses of the virtual machine. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + /// + /// Gets the OS type of the virtual machine. + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + /// + /// Gets the size of the virtual machine. + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets the network interface ID of the virtual machine. + /// + [JsonProperty(PropertyName = "networkInterfaceId")] + public string NetworkInterfaceId { get; set; } + + /// + /// Gets OS disk blob uri for the virtual machine. + /// + [JsonProperty(PropertyName = "osDiskId")] + public string OsDiskId { get; set; } + + /// + /// Gets data disks blob uri for the virtual machine. + /// + [JsonProperty(PropertyName = "dataDiskIds")] + public IList DataDiskIds { get; set; } + + /// + /// Gets all data disks attached to the virtual machine. + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs new file mode 100644 index 000000000000..6d1ca72339ed --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a virtual machine returned by the Microsoft.Compute API. + /// + public partial class ComputeVmPropertiesFragment + { + /// + /// Initializes a new instance of the ComputeVmPropertiesFragment + /// class. + /// + public ComputeVmPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeVmPropertiesFragment + /// class. + /// + /// Gets the statuses of the virtual + /// machine. + /// Gets the OS type of the virtual + /// machine. + /// Gets the size of the virtual machine. + /// Gets the network interface ID of + /// the virtual machine. + /// Gets OS disk blob uri for the virtual + /// machine. + /// Gets data disks blob uri for the virtual + /// machine. + /// Gets all data disks attached to the virtual + /// machine. + public ComputeVmPropertiesFragment(IList statuses = default(IList), string osType = default(string), string vmSize = default(string), string networkInterfaceId = default(string), string osDiskId = default(string), IList dataDiskIds = default(IList), IList dataDisks = default(IList)) + { + Statuses = statuses; + OsType = osType; + VmSize = vmSize; + NetworkInterfaceId = networkInterfaceId; + OsDiskId = osDiskId; + DataDiskIds = dataDiskIds; + DataDisks = dataDisks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the statuses of the virtual machine. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + /// + /// Gets the OS type of the virtual machine. + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + /// + /// Gets the size of the virtual machine. + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets the network interface ID of the virtual machine. + /// + [JsonProperty(PropertyName = "networkInterfaceId")] + public string NetworkInterfaceId { get; set; } + + /// + /// Gets OS disk blob uri for the virtual machine. + /// + [JsonProperty(PropertyName = "osDiskId")] + public string OsDiskId { get; set; } + + /// + /// Gets data disks blob uri for the virtual machine. + /// + [JsonProperty(PropertyName = "dataDiskIds")] + public IList DataDiskIds { get; set; } + + /// + /// Gets all data disks attached to the virtual machine. + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs new file mode 100644 index 000000000000..7c224fcdc91d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a cost threshold item. + /// + public partial class CostThresholdProperties + { + /// + /// Initializes a new instance of the CostThresholdProperties class. + /// + public CostThresholdProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CostThresholdProperties class. + /// + /// The ID of the cost threshold + /// item. + /// The value of the percentage cost + /// threshold. + /// Indicates whether this threshold will + /// be displayed on cost charts. Possible values include: 'Enabled', + /// 'Disabled' + /// Indicates whether + /// notifications will be sent when this threshold is exceeded. + /// Possible values include: 'Enabled', 'Disabled' + /// Indicates the datetime when + /// notifications were last sent for this threshold. + public CostThresholdProperties(string thresholdId = default(string), PercentageCostThresholdProperties percentageThreshold = default(PercentageCostThresholdProperties), string displayOnChart = default(string), string sendNotificationWhenExceeded = default(string), string notificationSent = default(string)) + { + ThresholdId = thresholdId; + PercentageThreshold = percentageThreshold; + DisplayOnChart = displayOnChart; + SendNotificationWhenExceeded = sendNotificationWhenExceeded; + NotificationSent = notificationSent; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ID of the cost threshold item. + /// + [JsonProperty(PropertyName = "thresholdId")] + public string ThresholdId { get; set; } + + /// + /// Gets or sets the value of the percentage cost threshold. + /// + [JsonProperty(PropertyName = "percentageThreshold")] + public PercentageCostThresholdProperties PercentageThreshold { get; set; } + + /// + /// Gets or sets indicates whether this threshold will be displayed on + /// cost charts. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "displayOnChart")] + public string DisplayOnChart { get; set; } + + /// + /// Gets or sets indicates whether notifications will be sent when this + /// threshold is exceeded. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "sendNotificationWhenExceeded")] + public string SendNotificationWhenExceeded { get; set; } + + /// + /// Gets or sets indicates the datetime when notifications were last + /// sent for this threshold. + /// + [JsonProperty(PropertyName = "notificationSent")] + public string NotificationSent { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs new file mode 100644 index 000000000000..044427749abb --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.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.DevTestLabs.Models +{ + + /// + /// Defines values for CostThresholdStatus. + /// + public static class CostThresholdStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs new file mode 100644 index 000000000000..3641c71fbca0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.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.DevTestLabs.Models +{ + + /// + /// Defines values for CostType. + /// + public static class CostType + { + public const string Unavailable = "Unavailable"; + public const string Reported = "Reported"; + public const string Projected = "Projected"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs new file mode 100644 index 000000000000..483d2b76f030 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A custom image. + /// + [Rest.Serialization.JsonTransformation] + public partial class CustomImage : Resource + { + /// + /// Initializes a new instance of the CustomImage class. + /// + public CustomImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImage class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The virtual machine from which the image is to be + /// created. + /// The VHD from which the image is to be + /// created. + /// The description of the custom + /// image. + /// The author of the custom image. + /// The creation date of the custom + /// image. + /// The Managed Image Id backing the + /// custom image. + /// The Managed Snapshot Id backing the + /// custom image. + /// Storage information about the + /// data disks present in the custom image + /// Storage information about the plan + /// related to this custom image + /// Whether or not the custom images + /// underlying offer/plan has been enabled for programmatic + /// deployment + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public CustomImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), CustomImagePropertiesFromVm vm = default(CustomImagePropertiesFromVm), CustomImagePropertiesCustom vhd = default(CustomImagePropertiesCustom), string description = default(string), string author = default(string), System.DateTime? creationDate = default(System.DateTime?), string managedImageId = default(string), string managedSnapshotId = default(string), IList dataDiskStorageInfo = default(IList), CustomImagePropertiesFromPlan customImagePlan = default(CustomImagePropertiesFromPlan), bool? isPlanAuthorized = default(bool?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + Vm = vm; + Vhd = vhd; + Description = description; + Author = author; + CreationDate = creationDate; + ManagedImageId = managedImageId; + ManagedSnapshotId = managedSnapshotId; + DataDiskStorageInfo = dataDiskStorageInfo; + CustomImagePlan = customImagePlan; + IsPlanAuthorized = isPlanAuthorized; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine from which the image is to be + /// created. + /// + [JsonProperty(PropertyName = "properties.vm")] + public CustomImagePropertiesFromVm Vm { get; set; } + + /// + /// Gets or sets the VHD from which the image is to be created. + /// + [JsonProperty(PropertyName = "properties.vhd")] + public CustomImagePropertiesCustom Vhd { get; set; } + + /// + /// Gets or sets the description of the custom image. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the author of the custom image. + /// + [JsonProperty(PropertyName = "properties.author")] + public string Author { get; set; } + + /// + /// Gets the creation date of the custom image. + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; private set; } + + /// + /// Gets or sets the Managed Image Id backing the custom image. + /// + [JsonProperty(PropertyName = "properties.managedImageId")] + public string ManagedImageId { get; set; } + + /// + /// Gets or sets the Managed Snapshot Id backing the custom image. + /// + [JsonProperty(PropertyName = "properties.managedSnapshotId")] + public string ManagedSnapshotId { get; set; } + + /// + /// Gets or sets storage information about the data disks present in + /// the custom image + /// + [JsonProperty(PropertyName = "properties.dataDiskStorageInfo")] + public IList DataDiskStorageInfo { get; set; } + + /// + /// Gets or sets storage information about the plan related to this + /// custom image + /// + [JsonProperty(PropertyName = "properties.customImagePlan")] + public CustomImagePropertiesFromPlan CustomImagePlan { get; set; } + + /// + /// Gets or sets whether or not the custom images underlying offer/plan + /// has been enabled for programmatic deployment + /// + [JsonProperty(PropertyName = "properties.isPlanAuthorized")] + public bool? IsPlanAuthorized { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Vhd != null) + { + Vhd.Validate(); + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageFragment.cs new file mode 100644 index 000000000000..38b0d9ac682b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageFragment.cs @@ -0,0 +1,135 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A custom image. + /// + [Rest.Serialization.JsonTransformation] + public partial class CustomImageFragment : UpdateResource + { + /// + /// Initializes a new instance of the CustomImageFragment class. + /// + public CustomImageFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImageFragment class. + /// + /// The tags of the resource. + /// The virtual machine from which the image is to be + /// created. + /// The VHD from which the image is to be + /// created. + /// The description of the custom + /// image. + /// The author of the custom image. + /// The Managed Image Id backing the + /// custom image. + /// The Managed Snapshot Id backing the + /// custom image. + /// Storage information about the + /// data disks present in the custom image + /// Storage information about the plan + /// related to this custom image + /// Whether or not the custom images + /// underlying offer/plan has been enabled for programmatic + /// deployment + public CustomImageFragment(IDictionary tags = default(IDictionary), CustomImagePropertiesFromVmFragment vm = default(CustomImagePropertiesFromVmFragment), CustomImagePropertiesCustomFragment vhd = default(CustomImagePropertiesCustomFragment), string description = default(string), string author = default(string), string managedImageId = default(string), string managedSnapshotId = default(string), IList dataDiskStorageInfo = default(IList), CustomImagePropertiesFromPlanFragment customImagePlan = default(CustomImagePropertiesFromPlanFragment), bool? isPlanAuthorized = default(bool?)) + : base(tags) + { + Vm = vm; + Vhd = vhd; + Description = description; + Author = author; + ManagedImageId = managedImageId; + ManagedSnapshotId = managedSnapshotId; + DataDiskStorageInfo = dataDiskStorageInfo; + CustomImagePlan = customImagePlan; + IsPlanAuthorized = isPlanAuthorized; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine from which the image is to be + /// created. + /// + [JsonProperty(PropertyName = "properties.vm")] + public CustomImagePropertiesFromVmFragment Vm { get; set; } + + /// + /// Gets or sets the VHD from which the image is to be created. + /// + [JsonProperty(PropertyName = "properties.vhd")] + public CustomImagePropertiesCustomFragment Vhd { get; set; } + + /// + /// Gets or sets the description of the custom image. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the author of the custom image. + /// + [JsonProperty(PropertyName = "properties.author")] + public string Author { get; set; } + + /// + /// Gets or sets the Managed Image Id backing the custom image. + /// + [JsonProperty(PropertyName = "properties.managedImageId")] + public string ManagedImageId { get; set; } + + /// + /// Gets or sets the Managed Snapshot Id backing the custom image. + /// + [JsonProperty(PropertyName = "properties.managedSnapshotId")] + public string ManagedSnapshotId { get; set; } + + /// + /// Gets or sets storage information about the data disks present in + /// the custom image + /// + [JsonProperty(PropertyName = "properties.dataDiskStorageInfo")] + public IList DataDiskStorageInfo { get; set; } + + /// + /// Gets or sets storage information about the plan related to this + /// custom image + /// + [JsonProperty(PropertyName = "properties.customImagePlan")] + public CustomImagePropertiesFromPlanFragment CustomImagePlan { get; set; } + + /// + /// Gets or sets whether or not the custom images underlying offer/plan + /// has been enabled for programmatic deployment + /// + [JsonProperty(PropertyName = "properties.isPlanAuthorized")] + public bool? IsPlanAuthorized { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs new file mode 100644 index 000000000000..c1ea2b2f2597 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.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.DevTestLabs.Models +{ + + /// + /// Defines values for CustomImageOsType. + /// + public static class CustomImageOsType + { + public const string Windows = "Windows"; + public const string Linux = "Linux"; + public const string None = "None"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs new file mode 100644 index 000000000000..fe22d2fbf1d7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for creating a custom image from a VHD. + /// + public partial class CustomImagePropertiesCustom + { + /// + /// Initializes a new instance of the CustomImagePropertiesCustom + /// class. + /// + public CustomImagePropertiesCustom() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImagePropertiesCustom + /// class. + /// + /// The OS type of the custom image (i.e. Windows, + /// Linux). Possible values include: 'Windows', 'Linux', 'None' + /// The image name. + /// Indicates whether sysprep has been run on the + /// VHD. + public CustomImagePropertiesCustom(string osType, string imageName = default(string), bool? sysPrep = default(bool?)) + { + ImageName = imageName; + SysPrep = sysPrep; + OsType = osType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the image name. + /// + [JsonProperty(PropertyName = "imageName")] + public string ImageName { get; set; } + + /// + /// Gets or sets indicates whether sysprep has been run on the VHD. + /// + [JsonProperty(PropertyName = "sysPrep")] + public bool? SysPrep { get; set; } + + /// + /// Gets or sets the OS type of the custom image (i.e. Windows, Linux). + /// Possible values include: 'Windows', 'Linux', 'None' + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustomFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustomFragment.cs new file mode 100644 index 000000000000..69a57595e5d7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustomFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for creating a custom image from a VHD. + /// + public partial class CustomImagePropertiesCustomFragment + { + /// + /// Initializes a new instance of the + /// CustomImagePropertiesCustomFragment class. + /// + public CustomImagePropertiesCustomFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CustomImagePropertiesCustomFragment class. + /// + /// The image name. + /// Indicates whether sysprep has been run on the + /// VHD. + /// The OS type of the custom image (i.e. Windows, + /// Linux). Possible values include: 'Windows', 'Linux', 'None' + public CustomImagePropertiesCustomFragment(string imageName = default(string), bool? sysPrep = default(bool?), string osType = default(string)) + { + ImageName = imageName; + SysPrep = sysPrep; + OsType = osType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the image name. + /// + [JsonProperty(PropertyName = "imageName")] + public string ImageName { get; set; } + + /// + /// Gets or sets indicates whether sysprep has been run on the VHD. + /// + [JsonProperty(PropertyName = "sysPrep")] + public bool? SysPrep { get; set; } + + /// + /// Gets or sets the OS type of the custom image (i.e. Windows, Linux). + /// Possible values include: 'Windows', 'Linux', 'None' + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlan.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlan.cs new file mode 100644 index 000000000000..dee8539454bc --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlan.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for plan on a custom image. + /// + public partial class CustomImagePropertiesFromPlan + { + /// + /// Initializes a new instance of the CustomImagePropertiesFromPlan + /// class. + /// + public CustomImagePropertiesFromPlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImagePropertiesFromPlan + /// class. + /// + /// The id of the plan, equivalent to name of the + /// plan + /// The publisher for the plan from the + /// marketplace image the custom image is derived from + /// The offer for the plan from the marketplace + /// image the custom image is derived from + public CustomImagePropertiesFromPlan(string id = default(string), string publisher = default(string), string offer = default(string)) + { + Id = id; + Publisher = publisher; + Offer = offer; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of the plan, equivalent to name of the plan + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the publisher for the plan from the marketplace image + /// the custom image is derived from + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the offer for the plan from the marketplace image the + /// custom image is derived from + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlanFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlanFragment.cs new file mode 100644 index 000000000000..7a1ef66b95ea --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlanFragment.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for plan on a custom image. + /// + public partial class CustomImagePropertiesFromPlanFragment + { + /// + /// Initializes a new instance of the + /// CustomImagePropertiesFromPlanFragment class. + /// + public CustomImagePropertiesFromPlanFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CustomImagePropertiesFromPlanFragment class. + /// + /// The id of the plan, equivalent to name of the + /// plan + /// The publisher for the plan from the + /// marketplace image the custom image is derived from + /// The offer for the plan from the marketplace + /// image the custom image is derived from + public CustomImagePropertiesFromPlanFragment(string id = default(string), string publisher = default(string), string offer = default(string)) + { + Id = id; + Publisher = publisher; + Offer = offer; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of the plan, equivalent to name of the plan + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the publisher for the plan from the marketplace image + /// the custom image is derived from + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the offer for the plan from the marketplace image the + /// custom image is derived from + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs new file mode 100644 index 000000000000..08b8fdce4707 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for creating a custom image from a virtual machine. + /// + public partial class CustomImagePropertiesFromVm + { + /// + /// Initializes a new instance of the CustomImagePropertiesFromVm + /// class. + /// + public CustomImagePropertiesFromVm() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImagePropertiesFromVm + /// class. + /// + /// The source vm identifier. + /// The Windows OS information of the + /// VM. + /// The Linux OS information of the + /// VM. + public CustomImagePropertiesFromVm(string sourceVmId = default(string), WindowsOsInfo windowsOsInfo = default(WindowsOsInfo), LinuxOsInfo linuxOsInfo = default(LinuxOsInfo)) + { + SourceVmId = sourceVmId; + WindowsOsInfo = windowsOsInfo; + LinuxOsInfo = linuxOsInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source vm identifier. + /// + [JsonProperty(PropertyName = "sourceVmId")] + public string SourceVmId { get; set; } + + /// + /// Gets or sets the Windows OS information of the VM. + /// + [JsonProperty(PropertyName = "windowsOsInfo")] + public WindowsOsInfo WindowsOsInfo { get; set; } + + /// + /// Gets or sets the Linux OS information of the VM. + /// + [JsonProperty(PropertyName = "linuxOsInfo")] + public LinuxOsInfo LinuxOsInfo { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVmFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVmFragment.cs new file mode 100644 index 000000000000..ab699cbe6464 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVmFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for creating a custom image from a virtual machine. + /// + public partial class CustomImagePropertiesFromVmFragment + { + /// + /// Initializes a new instance of the + /// CustomImagePropertiesFromVmFragment class. + /// + public CustomImagePropertiesFromVmFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CustomImagePropertiesFromVmFragment class. + /// + /// The source vm identifier. + /// The Windows OS information of the + /// VM. + /// The Linux OS information of the + /// VM. + public CustomImagePropertiesFromVmFragment(string sourceVmId = default(string), WindowsOsInfoFragment windowsOsInfo = default(WindowsOsInfoFragment), LinuxOsInfoFragment linuxOsInfo = default(LinuxOsInfoFragment)) + { + SourceVmId = sourceVmId; + WindowsOsInfo = windowsOsInfo; + LinuxOsInfo = linuxOsInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source vm identifier. + /// + [JsonProperty(PropertyName = "sourceVmId")] + public string SourceVmId { get; set; } + + /// + /// Gets or sets the Windows OS information of the VM. + /// + [JsonProperty(PropertyName = "windowsOsInfo")] + public WindowsOsInfoFragment WindowsOsInfo { get; set; } + + /// + /// Gets or sets the Linux OS information of the VM. + /// + [JsonProperty(PropertyName = "linuxOsInfo")] + public LinuxOsInfoFragment LinuxOsInfo { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs new file mode 100644 index 000000000000..20cb65e6a8dc --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Request body for adding a new or existing data disk to a virtual + /// machine. + /// + public partial class DataDiskProperties + { + /// + /// Initializes a new instance of the DataDiskProperties class. + /// + public DataDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskProperties class. + /// + /// Specifies options to attach + /// a new disk to the virtual machine. + /// Specifies the existing lab disk id + /// to attach to virtual machine. + /// Caching option for a data disk (i.e. + /// None, ReadOnly, ReadWrite). Possible values include: 'None', + /// 'ReadOnly', 'ReadWrite' + public DataDiskProperties(AttachNewDataDiskOptions attachNewDataDiskOptions = default(AttachNewDataDiskOptions), string existingLabDiskId = default(string), string hostCaching = default(string)) + { + AttachNewDataDiskOptions = attachNewDataDiskOptions; + ExistingLabDiskId = existingLabDiskId; + HostCaching = hostCaching; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies options to attach a new disk to the virtual + /// machine. + /// + [JsonProperty(PropertyName = "attachNewDataDiskOptions")] + public AttachNewDataDiskOptions AttachNewDataDiskOptions { get; set; } + + /// + /// Gets or sets specifies the existing lab disk id to attach to + /// virtual machine. + /// + [JsonProperty(PropertyName = "existingLabDiskId")] + public string ExistingLabDiskId { get; set; } + + /// + /// Gets or sets caching option for a data disk (i.e. None, ReadOnly, + /// ReadWrite). Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// + [JsonProperty(PropertyName = "hostCaching")] + public string HostCaching { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskPropertiesFragment.cs new file mode 100644 index 000000000000..d1b8c1a11dd8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskPropertiesFragment.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Request body for adding a new or existing data disk to a virtual + /// machine. + /// + public partial class DataDiskPropertiesFragment + { + /// + /// Initializes a new instance of the DataDiskPropertiesFragment class. + /// + public DataDiskPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskPropertiesFragment class. + /// + /// Specifies options to attach + /// a new disk to the virtual machine. + /// Specifies the existing lab disk id + /// to attach to virtual machine. + /// Caching option for a data disk (i.e. + /// None, ReadOnly, ReadWrite). Possible values include: 'None', + /// 'ReadOnly', 'ReadWrite' + public DataDiskPropertiesFragment(AttachNewDataDiskOptionsFragment attachNewDataDiskOptions = default(AttachNewDataDiskOptionsFragment), string existingLabDiskId = default(string), string hostCaching = default(string)) + { + AttachNewDataDiskOptions = attachNewDataDiskOptions; + ExistingLabDiskId = existingLabDiskId; + HostCaching = hostCaching; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies options to attach a new disk to the virtual + /// machine. + /// + [JsonProperty(PropertyName = "attachNewDataDiskOptions")] + public AttachNewDataDiskOptionsFragment AttachNewDataDiskOptions { get; set; } + + /// + /// Gets or sets specifies the existing lab disk id to attach to + /// virtual machine. + /// + [JsonProperty(PropertyName = "existingLabDiskId")] + public string ExistingLabDiskId { get; set; } + + /// + /// Gets or sets caching option for a data disk (i.e. None, ReadOnly, + /// ReadWrite). Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// + [JsonProperty(PropertyName = "hostCaching")] + public string HostCaching { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfo.cs new file mode 100644 index 000000000000..71d238bd6573 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfo.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Storage information about the data disks present in the custom image + /// + public partial class DataDiskStorageTypeInfo + { + /// + /// Initializes a new instance of the DataDiskStorageTypeInfo class. + /// + public DataDiskStorageTypeInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskStorageTypeInfo class. + /// + /// Disk Lun + /// Disk Storage Type. Possible values + /// include: 'Standard', 'Premium' + public DataDiskStorageTypeInfo(string lun = default(string), string storageType = default(string)) + { + Lun = lun; + StorageType = storageType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets disk Lun + /// + [JsonProperty(PropertyName = "lun")] + public string Lun { get; set; } + + /// + /// Gets or sets disk Storage Type. Possible values include: + /// 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "storageType")] + public string StorageType { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfoFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfoFragment.cs new file mode 100644 index 000000000000..e5bf351eb416 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfoFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Storage information about the data disks present in the custom image + /// + public partial class DataDiskStorageTypeInfoFragment + { + /// + /// Initializes a new instance of the DataDiskStorageTypeInfoFragment + /// class. + /// + public DataDiskStorageTypeInfoFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskStorageTypeInfoFragment + /// class. + /// + /// Disk Lun + /// Disk Storage Type. Possible values + /// include: 'Standard', 'Premium' + public DataDiskStorageTypeInfoFragment(string lun = default(string), string storageType = default(string)) + { + Lun = lun; + StorageType = storageType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets disk Lun + /// + [JsonProperty(PropertyName = "lun")] + public string Lun { get; set; } + + /// + /// Gets or sets disk Storage Type. Possible values include: + /// 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "storageType")] + public string StorageType { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs new file mode 100644 index 000000000000..63c3ddbec6d9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a daily schedule. + /// + public partial class DayDetails + { + /// + /// Initializes a new instance of the DayDetails class. + /// + public DayDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DayDetails class. + /// + /// The time of day the schedule will occur. + public DayDetails(string time = default(string)) + { + Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time of day the schedule will occur. + /// + [JsonProperty(PropertyName = "time")] + public string Time { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs new file mode 100644 index 000000000000..411c0d965773 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a daily schedule. + /// + public partial class DayDetailsFragment + { + /// + /// Initializes a new instance of the DayDetailsFragment class. + /// + public DayDetailsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DayDetailsFragment class. + /// + /// The time of day the schedule will occur. + public DayDetailsFragment(string time = default(string)) + { + Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time of day the schedule will occur. + /// + [JsonProperty(PropertyName = "time")] + public string Time { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs new file mode 100644 index 000000000000..831adf71d768 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Request body for detaching data disk from a virtual machine. + /// + public partial class DetachDataDiskProperties + { + /// + /// Initializes a new instance of the DetachDataDiskProperties class. + /// + public DetachDataDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DetachDataDiskProperties class. + /// + /// Specifies the disk resource ID to + /// detach from virtual machine. + public DetachDataDiskProperties(string existingLabDiskId = default(string)) + { + ExistingLabDiskId = existingLabDiskId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the disk resource ID to detach from virtual + /// machine. + /// + [JsonProperty(PropertyName = "existingLabDiskId")] + public string ExistingLabDiskId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs new file mode 100644 index 000000000000..1b7f32948b97 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the disk to detach. + /// + public partial class DetachDiskProperties + { + /// + /// Initializes a new instance of the DetachDiskProperties class. + /// + public DetachDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DetachDiskProperties class. + /// + /// The resource ID of the Lab VM to + /// which the disk is attached. + public DetachDiskProperties(string leasedByLabVmId = default(string)) + { + LeasedByLabVmId = leasedByLabVmId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the Lab VM to which the disk is + /// attached. + /// + [JsonProperty(PropertyName = "leasedByLabVmId")] + public string LeasedByLabVmId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs new file mode 100644 index 000000000000..0402b2481089 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Disk. + /// + [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. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The storage type for the disk (i.e. + /// Standard, Premium). Possible values include: 'Standard', + /// 'Premium' + /// The size of the disk in + /// GibiBytes. + /// The resource ID of the VM to which + /// this disk is leased. + /// When backed by a blob, the name of the + /// VHD blob without extension. + /// When backed by a blob, the URI of underlying + /// blob. + /// The creation date of the disk. + /// The host caching policy of the disk (i.e. + /// None, ReadOnly, ReadWrite). + /// When backed by managed disk, this is + /// the ID of the compute disk resource. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public Disk(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string diskType = default(string), int? diskSizeGiB = default(int?), string leasedByLabVmId = default(string), string diskBlobName = default(string), string diskUri = default(string), System.DateTime? createdDate = default(System.DateTime?), string hostCaching = default(string), string managedDiskId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + DiskType = diskType; + DiskSizeGiB = diskSizeGiB; + LeasedByLabVmId = leasedByLabVmId; + DiskBlobName = diskBlobName; + DiskUri = diskUri; + CreatedDate = createdDate; + HostCaching = hostCaching; + ManagedDiskId = managedDiskId; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the storage type for the disk (i.e. Standard, + /// Premium). Possible values include: 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "properties.diskType")] + public string DiskType { get; set; } + + /// + /// Gets or sets the size of the disk in GibiBytes. + /// + [JsonProperty(PropertyName = "properties.diskSizeGiB")] + public int? DiskSizeGiB { get; set; } + + /// + /// Gets or sets the resource ID of the VM to which this disk is + /// leased. + /// + [JsonProperty(PropertyName = "properties.leasedByLabVmId")] + public string LeasedByLabVmId { get; set; } + + /// + /// Gets or sets when backed by a blob, the name of the VHD blob + /// without extension. + /// + [JsonProperty(PropertyName = "properties.diskBlobName")] + public string DiskBlobName { get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [JsonProperty(PropertyName = "properties.diskUri")] + public string DiskUri { get; set; } + + /// + /// Gets the creation date of the disk. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets or sets the host caching policy of the disk (i.e. None, + /// ReadOnly, ReadWrite). + /// + [JsonProperty(PropertyName = "properties.hostCaching")] + public string HostCaching { get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the + /// compute disk resource. + /// + [JsonProperty(PropertyName = "properties.managedDiskId")] + public string ManagedDiskId { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskFragment.cs new file mode 100644 index 000000000000..ba04894b7820 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Disk. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskFragment : UpdateResource + { + /// + /// Initializes a new instance of the DiskFragment class. + /// + public DiskFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskFragment class. + /// + /// The tags of the resource. + /// The storage type for the disk (i.e. + /// Standard, Premium). Possible values include: 'Standard', + /// 'Premium' + /// The size of the disk in + /// GibiBytes. + /// The resource ID of the VM to which + /// this disk is leased. + /// When backed by a blob, the name of the + /// VHD blob without extension. + /// When backed by a blob, the URI of underlying + /// blob. + /// The host caching policy of the disk (i.e. + /// None, ReadOnly, ReadWrite). + /// When backed by managed disk, this is + /// the ID of the compute disk resource. + public DiskFragment(IDictionary tags = default(IDictionary), string diskType = default(string), int? diskSizeGiB = default(int?), string leasedByLabVmId = default(string), string diskBlobName = default(string), string diskUri = default(string), string hostCaching = default(string), string managedDiskId = default(string)) + : base(tags) + { + DiskType = diskType; + DiskSizeGiB = diskSizeGiB; + LeasedByLabVmId = leasedByLabVmId; + DiskBlobName = diskBlobName; + DiskUri = diskUri; + HostCaching = hostCaching; + ManagedDiskId = managedDiskId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the storage type for the disk (i.e. Standard, + /// Premium). Possible values include: 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "properties.diskType")] + public string DiskType { get; set; } + + /// + /// Gets or sets the size of the disk in GibiBytes. + /// + [JsonProperty(PropertyName = "properties.diskSizeGiB")] + public int? DiskSizeGiB { get; set; } + + /// + /// Gets or sets the resource ID of the VM to which this disk is + /// leased. + /// + [JsonProperty(PropertyName = "properties.leasedByLabVmId")] + public string LeasedByLabVmId { get; set; } + + /// + /// Gets or sets when backed by a blob, the name of the VHD blob + /// without extension. + /// + [JsonProperty(PropertyName = "properties.diskBlobName")] + public string DiskBlobName { get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [JsonProperty(PropertyName = "properties.diskUri")] + public string DiskUri { get; set; } + + /// + /// Gets or sets the host caching policy of the disk (i.e. None, + /// ReadOnly, ReadWrite). + /// + [JsonProperty(PropertyName = "properties.hostCaching")] + public string HostCaching { get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the + /// compute disk resource. + /// + [JsonProperty(PropertyName = "properties.managedDiskId")] + public string ManagedDiskId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs new file mode 100644 index 000000000000..7fe0ae7b08b1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An environment, which is essentially an ARM template deployment. + /// + [Rest.Serialization.JsonTransformation] + public partial class DtlEnvironment : Resource + { + /// + /// Initializes a new instance of the DtlEnvironment class. + /// + public DtlEnvironment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DtlEnvironment class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The deployment properties of the + /// environment. + /// The display name of the Azure + /// Resource Manager template that produced the environment. + /// The identifier of the resource group + /// containing the environment's resources. + /// The creator of the environment. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public DtlEnvironment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), EnvironmentDeploymentProperties deploymentProperties = default(EnvironmentDeploymentProperties), string armTemplateDisplayName = default(string), string resourceGroupId = default(string), string createdByUser = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + DeploymentProperties = deploymentProperties; + ArmTemplateDisplayName = armTemplateDisplayName; + ResourceGroupId = resourceGroupId; + CreatedByUser = createdByUser; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the deployment properties of the environment. + /// + [JsonProperty(PropertyName = "properties.deploymentProperties")] + public EnvironmentDeploymentProperties DeploymentProperties { get; set; } + + /// + /// Gets or sets the display name of the Azure Resource Manager + /// template that produced the environment. + /// + [JsonProperty(PropertyName = "properties.armTemplateDisplayName")] + public string ArmTemplateDisplayName { get; set; } + + /// + /// Gets the identifier of the resource group containing the + /// environment's resources. + /// + [JsonProperty(PropertyName = "properties.resourceGroupId")] + public string ResourceGroupId { get; private set; } + + /// + /// Gets the creator of the environment. + /// + [JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser { get; private set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironmentFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironmentFragment.cs new file mode 100644 index 000000000000..935bd0aae51b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironmentFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An environment, which is essentially an ARM template deployment. + /// + [Rest.Serialization.JsonTransformation] + public partial class DtlEnvironmentFragment : UpdateResource + { + /// + /// Initializes a new instance of the DtlEnvironmentFragment class. + /// + public DtlEnvironmentFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DtlEnvironmentFragment class. + /// + /// The tags of the resource. + /// The deployment properties of the + /// environment. + /// The display name of the Azure + /// Resource Manager template that produced the environment. + public DtlEnvironmentFragment(IDictionary tags = default(IDictionary), EnvironmentDeploymentPropertiesFragment deploymentProperties = default(EnvironmentDeploymentPropertiesFragment), string armTemplateDisplayName = default(string)) + : base(tags) + { + DeploymentProperties = deploymentProperties; + ArmTemplateDisplayName = armTemplateDisplayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the deployment properties of the environment. + /// + [JsonProperty(PropertyName = "properties.deploymentProperties")] + public EnvironmentDeploymentPropertiesFragment DeploymentProperties { get; set; } + + /// + /// Gets or sets the display name of the Azure Resource Manager + /// template that produced the environment. + /// + [JsonProperty(PropertyName = "properties.armTemplateDisplayName")] + public string ArmTemplateDisplayName { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs new file mode 100644 index 000000000000..275695266d64 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.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.DevTestLabs.Models +{ + + /// + /// Defines values for EnableStatus. + /// + public static class EnableStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs new file mode 100644 index 000000000000..7f232051558b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of an environment deployment. + /// + public partial class EnvironmentDeploymentProperties + { + /// + /// Initializes a new instance of the EnvironmentDeploymentProperties + /// class. + /// + public EnvironmentDeploymentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentDeploymentProperties + /// class. + /// + /// The Azure Resource Manager template's + /// identifier. + /// The parameters of the Azure Resource + /// Manager template. + public EnvironmentDeploymentProperties(string armTemplateId = default(string), IList parameters = default(IList)) + { + ArmTemplateId = armTemplateId; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Azure Resource Manager template's identifier. + /// + [JsonProperty(PropertyName = "armTemplateId")] + public string ArmTemplateId { get; set; } + + /// + /// Gets or sets the parameters of the Azure Resource Manager template. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentPropertiesFragment.cs new file mode 100644 index 000000000000..6e9038a43d85 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentPropertiesFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of an environment deployment. + /// + public partial class EnvironmentDeploymentPropertiesFragment + { + /// + /// Initializes a new instance of the + /// EnvironmentDeploymentPropertiesFragment class. + /// + public EnvironmentDeploymentPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EnvironmentDeploymentPropertiesFragment class. + /// + /// The Azure Resource Manager template's + /// identifier. + /// The parameters of the Azure Resource + /// Manager template. + public EnvironmentDeploymentPropertiesFragment(string armTemplateId = default(string), IList parameters = default(IList)) + { + ArmTemplateId = armTemplateId; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Azure Resource Manager template's identifier. + /// + [JsonProperty(PropertyName = "armTemplateId")] + public string ArmTemplateId { get; set; } + + /// + /// Gets or sets the parameters of the Azure Resource Manager template. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentPermission.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentPermission.cs new file mode 100644 index 000000000000..cb17c329d50e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentPermission.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.DevTestLabs.Models +{ + + /// + /// Defines values for EnvironmentPermission. + /// + public static class EnvironmentPermission + { + public const string Reader = "Reader"; + public const string Contributor = "Contributor"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs new file mode 100644 index 000000000000..89941f6b30ef --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for evaluating a policy set. + /// + public partial class EvaluatePoliciesProperties + { + /// + /// Initializes a new instance of the EvaluatePoliciesProperties class. + /// + public EvaluatePoliciesProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EvaluatePoliciesProperties class. + /// + /// The fact name. + /// The fact data. + /// The value offset. + /// The user for which policies will be + /// evaluated + public EvaluatePoliciesProperties(string factName = default(string), string factData = default(string), string valueOffset = default(string), string userObjectId = default(string)) + { + FactName = factName; + FactData = factData; + ValueOffset = valueOffset; + UserObjectId = userObjectId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the fact name. + /// + [JsonProperty(PropertyName = "factName")] + public string FactName { get; set; } + + /// + /// Gets or sets the fact data. + /// + [JsonProperty(PropertyName = "factData")] + public string FactData { get; set; } + + /// + /// Gets or sets the value offset. + /// + [JsonProperty(PropertyName = "valueOffset")] + public string ValueOffset { get; set; } + + /// + /// Gets or sets the user for which policies will be evaluated + /// + [JsonProperty(PropertyName = "userObjectId")] + public string UserObjectId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs new file mode 100644 index 000000000000..b475886904f8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Request body for evaluating a policy set. + /// + public partial class EvaluatePoliciesRequest + { + /// + /// Initializes a new instance of the EvaluatePoliciesRequest class. + /// + public EvaluatePoliciesRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EvaluatePoliciesRequest class. + /// + /// Policies to evaluate. + public EvaluatePoliciesRequest(IList policies = default(IList)) + { + Policies = policies; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets policies to evaluate. + /// + [JsonProperty(PropertyName = "policies")] + public IList Policies { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs new file mode 100644 index 000000000000..2863860ca890 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Response body for evaluating a policy set. + /// + public partial class EvaluatePoliciesResponse + { + /// + /// Initializes a new instance of the EvaluatePoliciesResponse class. + /// + public EvaluatePoliciesResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EvaluatePoliciesResponse class. + /// + /// Results of evaluating a policy set. + public EvaluatePoliciesResponse(IList results = default(IList)) + { + Results = results; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets results of evaluating a policy set. + /// + [JsonProperty(PropertyName = "results")] + public IList Results { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs new file mode 100644 index 000000000000..70a246af5764 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An event to be notified for. + /// + public partial class EventFragment + { + /// + /// Initializes a new instance of the EventFragment class. + /// + public EventFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventFragment class. + /// + /// The event type for which this notification + /// is enabled (i.e. AutoShutdown, Cost). Possible values include: + /// 'AutoShutdown', 'Cost' + public EventFragment(string eventName = default(string)) + { + EventName = eventName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the event type for which this notification is enabled + /// (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', + /// 'Cost' + /// + [JsonProperty(PropertyName = "eventName")] + public string EventName { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs new file mode 100644 index 000000000000..acbff2cccecf --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An event to be notified for. + /// + public partial class EventModel + { + /// + /// Initializes a new instance of the EventModel class. + /// + public EventModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventModel class. + /// + /// The event type for which this notification + /// is enabled (i.e. AutoShutdown, Cost). Possible values include: + /// 'AutoShutdown', 'Cost' + public EventModel(string eventName = default(string)) + { + EventName = eventName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the event type for which this notification is enabled + /// (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', + /// 'Cost' + /// + [JsonProperty(PropertyName = "eventName")] + public string EventName { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs new file mode 100644 index 000000000000..64c01216e84c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters of the export operation. + /// + public partial class ExportResourceUsageParameters + { + /// + /// Initializes a new instance of the ExportResourceUsageParameters + /// class. + /// + public ExportResourceUsageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExportResourceUsageParameters + /// class. + /// + /// The blob storage absolute + /// sas uri with write permission to the container which the usage data + /// needs to be uploaded to. + /// The start time of the usage. If not + /// provided, usage will be reported since the beginning of data + /// collection. + public ExportResourceUsageParameters(string blobStorageAbsoluteSasUri = default(string), System.DateTime? usageStartDate = default(System.DateTime?)) + { + BlobStorageAbsoluteSasUri = blobStorageAbsoluteSasUri; + UsageStartDate = usageStartDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the blob storage absolute sas uri with write + /// permission to the container which the usage data needs to be + /// uploaded to. + /// + [JsonProperty(PropertyName = "blobStorageAbsoluteSasUri")] + public string BlobStorageAbsoluteSasUri { get; set; } + + /// + /// Gets or sets the start time of the usage. If not provided, usage + /// will be reported since the beginning of data collection. + /// + [JsonProperty(PropertyName = "usageStartDate")] + public System.DateTime? UsageStartDate { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs new file mode 100644 index 000000000000..1b5d3ba8b0b4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Subnet information as returned by the Microsoft.Network API. + /// + public partial class ExternalSubnet + { + /// + /// Initializes a new instance of the ExternalSubnet class. + /// + public ExternalSubnet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExternalSubnet class. + /// + /// Gets or sets the identifier. + /// Gets or sets the name. + public ExternalSubnet(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 or sets the identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs new file mode 100644 index 000000000000..63b781689d81 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Subnet information as returned by the Microsoft.Network API. + /// + public partial class ExternalSubnetFragment + { + /// + /// Initializes a new instance of the ExternalSubnetFragment class. + /// + public ExternalSubnetFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExternalSubnetFragment class. + /// + /// Gets or sets the identifier. + /// Gets or sets the name. + public ExternalSubnetFragment(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 or sets the identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs new file mode 100644 index 000000000000..c941785310e8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.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.DevTestLabs.Models +{ + + /// + /// Defines values for FileUploadOptions. + /// + public static class FileUploadOptions + { + public const string UploadFilesAndGenerateSasTokens = "UploadFilesAndGenerateSasTokens"; + public const string None = "None"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs new file mode 100644 index 000000000000..7263423b236b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A formula for creating a VM, specifying an image base and other + /// parameters + /// + [Rest.Serialization.JsonTransformation] + public partial class Formula : Resource + { + /// + /// Initializes a new instance of the Formula class. + /// + public Formula() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Formula class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The description of the formula. + /// The author of the formula. + /// The OS type of the formula. + /// The creation date of the + /// formula. + /// The content of the formula. + /// Information about a VM from which a formula is to + /// be created. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public Formula(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string description = default(string), string author = default(string), string osType = default(string), System.DateTime? creationDate = default(System.DateTime?), LabVirtualMachineCreationParameter formulaContent = default(LabVirtualMachineCreationParameter), FormulaPropertiesFromVm vm = default(FormulaPropertiesFromVm), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + Description = description; + Author = author; + OsType = osType; + CreationDate = creationDate; + FormulaContent = formulaContent; + Vm = vm; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of the formula. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the author of the formula. + /// + [JsonProperty(PropertyName = "properties.author")] + public string Author { get; set; } + + /// + /// Gets or sets the OS type of the formula. + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets the creation date of the formula. + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; private set; } + + /// + /// Gets or sets the content of the formula. + /// + [JsonProperty(PropertyName = "properties.formulaContent")] + public LabVirtualMachineCreationParameter FormulaContent { get; set; } + + /// + /// Gets or sets information about a VM from which a formula is to be + /// created. + /// + [JsonProperty(PropertyName = "properties.vm")] + public FormulaPropertiesFromVm Vm { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaFragment.cs new file mode 100644 index 000000000000..a47688ce15b4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A formula for creating a VM, specifying an image base and other + /// parameters + /// + [Rest.Serialization.JsonTransformation] + public partial class FormulaFragment : UpdateResource + { + /// + /// Initializes a new instance of the FormulaFragment class. + /// + public FormulaFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FormulaFragment class. + /// + /// The tags of the resource. + /// The description of the formula. + /// The author of the formula. + /// The OS type of the formula. + /// The content of the formula. + /// Information about a VM from which a formula is to + /// be created. + public FormulaFragment(IDictionary tags = default(IDictionary), string description = default(string), string author = default(string), string osType = default(string), LabVirtualMachineCreationParameterFragment formulaContent = default(LabVirtualMachineCreationParameterFragment), FormulaPropertiesFromVmFragment vm = default(FormulaPropertiesFromVmFragment)) + : base(tags) + { + Description = description; + Author = author; + OsType = osType; + FormulaContent = formulaContent; + Vm = vm; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of the formula. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the author of the formula. + /// + [JsonProperty(PropertyName = "properties.author")] + public string Author { get; set; } + + /// + /// Gets or sets the OS type of the formula. + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets the content of the formula. + /// + [JsonProperty(PropertyName = "properties.formulaContent")] + public LabVirtualMachineCreationParameterFragment FormulaContent { get; set; } + + /// + /// Gets or sets information about a VM from which a formula is to be + /// created. + /// + [JsonProperty(PropertyName = "properties.vm")] + public FormulaPropertiesFromVmFragment Vm { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs new file mode 100644 index 000000000000..8a8484790d4b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a VM from which a formula is to be created. + /// + public partial class FormulaPropertiesFromVm + { + /// + /// Initializes a new instance of the FormulaPropertiesFromVm class. + /// + public FormulaPropertiesFromVm() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FormulaPropertiesFromVm class. + /// + /// The identifier of the VM from which a formula + /// is to be created. + public FormulaPropertiesFromVm(string labVmId = default(string)) + { + LabVmId = labVmId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identifier of the VM from which a formula is to be + /// created. + /// + [JsonProperty(PropertyName = "labVmId")] + public string LabVmId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVmFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVmFragment.cs new file mode 100644 index 000000000000..d8a6d8b0fe34 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVmFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a VM from which a formula is to be created. + /// + public partial class FormulaPropertiesFromVmFragment + { + /// + /// Initializes a new instance of the FormulaPropertiesFromVmFragment + /// class. + /// + public FormulaPropertiesFromVmFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FormulaPropertiesFromVmFragment + /// class. + /// + /// The identifier of the VM from which a formula + /// is to be created. + public FormulaPropertiesFromVmFragment(string labVmId = default(string)) + { + LabVmId = labVmId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identifier of the VM from which a formula is to be + /// created. + /// + [JsonProperty(PropertyName = "labVmId")] + public string LabVmId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs new file mode 100644 index 000000000000..6ce3d112757e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs @@ -0,0 +1,125 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A gallery image. + /// + [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. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The author of the gallery image. + /// The creation date of the gallery + /// image. + /// The description of the gallery + /// image. + /// The image reference of the gallery + /// image. + /// The icon of the gallery image. + /// Indicates whether this gallery image is + /// enabled. + /// The third party plan that applies to this + /// image + /// Indicates if the plan has been + /// authorized for programmatic deployment. + public GalleryImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?), string planId = default(string), bool? isPlanAuthorized = default(bool?)) + : base(id, name, type, location, tags) + { + Author = author; + CreatedDate = createdDate; + Description = description; + ImageReference = imageReference; + Icon = icon; + Enabled = enabled; + PlanId = planId; + IsPlanAuthorized = isPlanAuthorized; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the author of the gallery image. + /// + [JsonProperty(PropertyName = "properties.author")] + public string Author { get; set; } + + /// + /// Gets the creation date of the gallery image. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets or sets the description of the gallery image. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the image reference of the gallery image. + /// + [JsonProperty(PropertyName = "properties.imageReference")] + public GalleryImageReference ImageReference { get; set; } + + /// + /// Gets or sets the icon of the gallery image. + /// + [JsonProperty(PropertyName = "properties.icon")] + public string Icon { get; set; } + + /// + /// Gets or sets indicates whether this gallery image is enabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the third party plan that applies to this image + /// + [JsonProperty(PropertyName = "properties.planId")] + public string PlanId { get; set; } + + /// + /// Gets or sets indicates if the plan has been authorized for + /// programmatic deployment. + /// + [JsonProperty(PropertyName = "properties.isPlanAuthorized")] + public bool? IsPlanAuthorized { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs new file mode 100644 index 000000000000..47b51d16b606 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The reference information for an Azure Marketplace image. + /// + public partial class GalleryImageReference + { + /// + /// Initializes a new instance of the GalleryImageReference class. + /// + public GalleryImageReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageReference class. + /// + /// The offer of the gallery image. + /// The publisher of the gallery image. + /// The SKU of the gallery image. + /// The OS type of the gallery image. + /// The version of the gallery image. + public GalleryImageReference(string offer = default(string), string publisher = default(string), string sku = default(string), string osType = default(string), string version = default(string)) + { + Offer = offer; + Publisher = publisher; + Sku = sku; + OsType = osType; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the offer of the gallery image. + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets the publisher of the gallery image. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the SKU of the gallery image. + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Gets or sets the OS type of the gallery image. + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + /// + /// Gets or sets the version of the gallery image. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs new file mode 100644 index 000000000000..690ad674a0bd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The reference information for an Azure Marketplace image. + /// + public partial class GalleryImageReferenceFragment + { + /// + /// Initializes a new instance of the GalleryImageReferenceFragment + /// class. + /// + public GalleryImageReferenceFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageReferenceFragment + /// class. + /// + /// The offer of the gallery image. + /// The publisher of the gallery image. + /// The SKU of the gallery image. + /// The OS type of the gallery image. + /// The version of the gallery image. + public GalleryImageReferenceFragment(string offer = default(string), string publisher = default(string), string sku = default(string), string osType = default(string), string version = default(string)) + { + Offer = offer; + Publisher = publisher; + Sku = sku; + OsType = osType; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the offer of the gallery image. + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets the publisher of the gallery image. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the SKU of the gallery image. + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Gets or sets the OS type of the gallery image. + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + /// + /// Gets or sets the version of the gallery image. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs new file mode 100644 index 000000000000..0bea30d10a71 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// + public partial class GenerateArmTemplateRequest + { + /// + /// Initializes a new instance of the GenerateArmTemplateRequest class. + /// + public GenerateArmTemplateRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GenerateArmTemplateRequest class. + /// + /// The resource name of the virtual + /// machine. + /// The parameters of the ARM + /// template. + /// The location of the virtual machine. + /// Options for uploading the files for + /// the artifact. UploadFilesAndGenerateSasTokens is the default value. + /// Possible values include: 'UploadFilesAndGenerateSasTokens', + /// 'None' + public GenerateArmTemplateRequest(string virtualMachineName = default(string), IList parameters = default(IList), string location = default(string), string fileUploadOptions = default(string)) + { + VirtualMachineName = virtualMachineName; + Parameters = parameters; + Location = location; + FileUploadOptions = fileUploadOptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource name of the virtual machine. + /// + [JsonProperty(PropertyName = "virtualMachineName")] + public string VirtualMachineName { get; set; } + + /// + /// Gets or sets the parameters of the ARM template. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Gets or sets the location of the virtual machine. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets options for uploading the files for the artifact. + /// UploadFilesAndGenerateSasTokens is the default value. Possible + /// values include: 'UploadFilesAndGenerateSasTokens', 'None' + /// + [JsonProperty(PropertyName = "fileUploadOptions")] + public string FileUploadOptions { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs new file mode 100644 index 000000000000..d3aed3c1cd5a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for generating an upload URI. + /// + public partial class GenerateUploadUriParameter + { + /// + /// Initializes a new instance of the GenerateUploadUriParameter class. + /// + public GenerateUploadUriParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GenerateUploadUriParameter class. + /// + /// The blob name of the upload URI. + public GenerateUploadUriParameter(string blobName = default(string)) + { + BlobName = blobName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the blob name of the upload URI. + /// + [JsonProperty(PropertyName = "blobName")] + public string BlobName { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs new file mode 100644 index 000000000000..89138998bb1f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reponse body for generating an upload URI. + /// + public partial class GenerateUploadUriResponse + { + /// + /// Initializes a new instance of the GenerateUploadUriResponse class. + /// + public GenerateUploadUriResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GenerateUploadUriResponse class. + /// + /// The upload URI for the VHD. + public GenerateUploadUriResponse(string uploadUri = default(string)) + { + UploadUri = uploadUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the upload URI for the VHD. + /// + [JsonProperty(PropertyName = "uploadUri")] + public string UploadUri { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs new file mode 100644 index 000000000000..912a3ae969bb --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.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.DevTestLabs.Models +{ + + /// + /// Defines values for HostCachingOptions. + /// + public static class HostCachingOptions + { + public const string None = "None"; + public const string ReadOnly = "ReadOnly"; + public const string ReadWrite = "ReadWrite"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs new file mode 100644 index 000000000000..46baab3647c3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an hourly schedule. + /// + public partial class HourDetails + { + /// + /// Initializes a new instance of the HourDetails class. + /// + public HourDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HourDetails class. + /// + /// Minutes of the hour the schedule will + /// run. + public HourDetails(int? minute = default(int?)) + { + Minute = minute; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets minutes of the hour the schedule will run. + /// + [JsonProperty(PropertyName = "minute")] + public int? Minute { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs new file mode 100644 index 000000000000..9abc4c1f633f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an hourly schedule. + /// + public partial class HourDetailsFragment + { + /// + /// Initializes a new instance of the HourDetailsFragment class. + /// + public HourDetailsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HourDetailsFragment class. + /// + /// Minutes of the hour the schedule will + /// run. + public HourDetailsFragment(int? minute = default(int?)) + { + Minute = minute; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets minutes of the hour the schedule will run. + /// + [JsonProperty(PropertyName = "minute")] + public int? Minute { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs new file mode 100644 index 000000000000..ae65a3ee7c89 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.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.DevTestLabs.Models +{ + + /// + /// Defines values for HttpStatusCode. + /// + public static class HttpStatusCode + { + public const string Continue = "Continue"; + public const string SwitchingProtocols = "SwitchingProtocols"; + public const string OK = "OK"; + public const string Created = "Created"; + public const string Accepted = "Accepted"; + public const string NonAuthoritativeInformation = "NonAuthoritativeInformation"; + public const string NoContent = "NoContent"; + public const string ResetContent = "ResetContent"; + public const string PartialContent = "PartialContent"; + public const string MultipleChoices = "MultipleChoices"; + public const string MovedPermanently = "MovedPermanently"; + public const string Redirect = "Redirect"; + public const string SeeOther = "SeeOther"; + public const string NotModified = "NotModified"; + public const string UseProxy = "UseProxy"; + public const string Unused = "Unused"; + public const string TemporaryRedirect = "TemporaryRedirect"; + public const string BadRequest = "BadRequest"; + public const string Unauthorized = "Unauthorized"; + public const string PaymentRequired = "PaymentRequired"; + public const string Forbidden = "Forbidden"; + public const string NotFound = "NotFound"; + public const string MethodNotAllowed = "MethodNotAllowed"; + public const string NotAcceptable = "NotAcceptable"; + public const string ProxyAuthenticationRequired = "ProxyAuthenticationRequired"; + public const string RequestTimeout = "RequestTimeout"; + public const string Conflict = "Conflict"; + public const string Gone = "Gone"; + public const string LengthRequired = "LengthRequired"; + public const string PreconditionFailed = "PreconditionFailed"; + public const string RequestEntityTooLarge = "RequestEntityTooLarge"; + public const string RequestUriTooLong = "RequestUriTooLong"; + public const string UnsupportedMediaType = "UnsupportedMediaType"; + public const string RequestedRangeNotSatisfiable = "RequestedRangeNotSatisfiable"; + public const string ExpectationFailed = "ExpectationFailed"; + public const string UpgradeRequired = "UpgradeRequired"; + public const string InternalServerError = "InternalServerError"; + public const string NotImplemented = "NotImplemented"; + public const string BadGateway = "BadGateway"; + public const string ServiceUnavailable = "ServiceUnavailable"; + public const string GatewayTimeout = "GatewayTimeout"; + public const string HttpVersionNotSupported = "HttpVersionNotSupported"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs new file mode 100644 index 000000000000..852db48b0e93 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a managed identity + /// + public partial class IdentityProperties + { + /// + /// Initializes a new instance of the IdentityProperties class. + /// + public IdentityProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IdentityProperties class. + /// + /// Managed identity. + /// The principal id of resource + /// identity. + /// The tenant identifier of resource. + /// The client secret URL of the + /// identity. + public IdentityProperties(string type = default(string), string principalId = default(string), string tenantId = default(string), string clientSecretUrl = default(string)) + { + Type = type; + PrincipalId = principalId; + TenantId = tenantId; + ClientSecretUrl = clientSecretUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets managed identity. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the principal id of resource identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets the tenant identifier of resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the client secret URL of the identity. + /// + [JsonProperty(PropertyName = "clientSecretUrl")] + public string ClientSecretUrl { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ImportLabVirtualMachineRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ImportLabVirtualMachineRequest.cs new file mode 100644 index 000000000000..fc9e89c9ab18 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ImportLabVirtualMachineRequest.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This represents the payload required to import a virtual machine from a + /// different lab into the current one + /// + public partial class ImportLabVirtualMachineRequest + { + /// + /// Initializes a new instance of the ImportLabVirtualMachineRequest + /// class. + /// + public ImportLabVirtualMachineRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImportLabVirtualMachineRequest + /// class. + /// + /// The full resource ID + /// of the virtual machine to be imported. + /// The name of the virtual + /// machine in the destination lab + public ImportLabVirtualMachineRequest(string sourceVirtualMachineResourceId = default(string), string destinationVirtualMachineName = default(string)) + { + SourceVirtualMachineResourceId = sourceVirtualMachineResourceId; + DestinationVirtualMachineName = destinationVirtualMachineName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the full resource ID of the virtual machine to be + /// imported. + /// + [JsonProperty(PropertyName = "sourceVirtualMachineResourceId")] + public string SourceVirtualMachineResourceId { get; set; } + + /// + /// Gets or sets the name of the virtual machine in the destination lab + /// + [JsonProperty(PropertyName = "destinationVirtualMachineName")] + public string DestinationVirtualMachineName { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs new file mode 100644 index 000000000000..8c840c7bf05a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A rule for NAT - exposing a VM's port (backendPort) on the public IP + /// address using a load balancer. + /// + public partial class InboundNatRule + { + /// + /// Initializes a new instance of the InboundNatRule class. + /// + public InboundNatRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InboundNatRule class. + /// + /// The transport protocol for the + /// endpoint. Possible values include: 'Tcp', 'Udp' + /// The external endpoint port of the + /// inbound connection. Possible values range between 1 and 65535, + /// inclusive. If unspecified, a value will be allocated + /// automatically. + /// The port to which the external traffic + /// will be redirected. + public InboundNatRule(string transportProtocol = default(string), int? frontendPort = default(int?), int? backendPort = default(int?)) + { + TransportProtocol = transportProtocol; + FrontendPort = frontendPort; + BackendPort = backendPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the transport protocol for the endpoint. Possible + /// values include: 'Tcp', 'Udp' + /// + [JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol { get; set; } + + /// + /// Gets or sets the external endpoint port of the inbound connection. + /// Possible values range between 1 and 65535, inclusive. If + /// unspecified, a value will be allocated automatically. + /// + [JsonProperty(PropertyName = "frontendPort")] + public int? FrontendPort { get; set; } + + /// + /// Gets or sets the port to which the external traffic will be + /// redirected. + /// + [JsonProperty(PropertyName = "backendPort")] + public int? BackendPort { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs new file mode 100644 index 000000000000..eed034717d84 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A rule for NAT - exposing a VM's port (backendPort) on the public IP + /// address using a load balancer. + /// + public partial class InboundNatRuleFragment + { + /// + /// Initializes a new instance of the InboundNatRuleFragment class. + /// + public InboundNatRuleFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InboundNatRuleFragment class. + /// + /// The transport protocol for the + /// endpoint. Possible values include: 'Tcp', 'Udp' + /// The external endpoint port of the + /// inbound connection. Possible values range between 1 and 65535, + /// inclusive. If unspecified, a value will be allocated + /// automatically. + /// The port to which the external traffic + /// will be redirected. + public InboundNatRuleFragment(string transportProtocol = default(string), int? frontendPort = default(int?), int? backendPort = default(int?)) + { + TransportProtocol = transportProtocol; + FrontendPort = frontendPort; + BackendPort = backendPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the transport protocol for the endpoint. Possible + /// values include: 'Tcp', 'Udp' + /// + [JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol { get; set; } + + /// + /// Gets or sets the external endpoint port of the inbound connection. + /// Possible values range between 1 and 65535, inclusive. If + /// unspecified, a value will be allocated automatically. + /// + [JsonProperty(PropertyName = "frontendPort")] + public int? FrontendPort { get; set; } + + /// + /// Gets or sets the port to which the external traffic will be + /// redirected. + /// + [JsonProperty(PropertyName = "backendPort")] + public int? BackendPort { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs new file mode 100644 index 000000000000..59638a9abbf3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs @@ -0,0 +1,261 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A lab. + /// + [Rest.Serialization.JsonTransformation] + public partial class Lab : Resource + { + /// + /// Initializes a new instance of the Lab class. + /// + public Lab() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Lab class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The lab's default storage + /// account. + /// The lab's default + /// premium storage account. + /// The lab's artifact storage + /// account. + /// The lab's premium data + /// disk storage account. + /// The lab's Key vault. + /// Type of storage used by the lab. It + /// can be either Premium or Standard. Default is Premium. Possible + /// values include: 'Standard', 'Premium' + /// The ordered list + /// of artifact resource IDs that should be applied on all Linux VM + /// creations by default, prior to the artifacts specified by the + /// user. + /// The ordered list + /// of artifact resource IDs that should be applied on all Windows VM + /// creations by default, prior to the artifacts specified by the + /// user. + /// The creation date of the lab. + /// The setting to enable usage of + /// premium data disks. + /// When its value is 'Enabled', creation of standard or premium data + /// disks is allowed. + /// When its value is 'Disabled', only creation of standard data disks + /// is allowed. Possible values include: 'Disabled', 'Enabled' + /// The access rights to be granted + /// to the user when provisioning an environment. Possible values + /// include: 'Reader', 'Contributor' + /// The properties of any lab announcement + /// associated with this lab + /// The properties of any lab support message + /// associated with this lab + /// The resource group in which + /// lab virtual machines will be created in. + /// The public IP address for the lab's load + /// balancer. + /// The load balancer used to for lab VMs + /// that use shared IP address. + /// The Network Security Group + /// attached to the lab VMs Network interfaces to restrict open + /// ports. + /// Extended properties of the lab + /// used for experimental features + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public Lab(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string defaultStorageAccount = default(string), string defaultPremiumStorageAccount = default(string), string artifactsStorageAccount = default(string), string premiumDataDiskStorageAccount = default(string), string vaultName = default(string), string labStorageType = default(string), IList mandatoryArtifactsResourceIdsLinux = default(IList), IList mandatoryArtifactsResourceIdsWindows = default(IList), System.DateTime? createdDate = default(System.DateTime?), string premiumDataDisks = default(string), string environmentPermission = default(string), LabAnnouncementProperties announcement = default(LabAnnouncementProperties), LabSupportProperties support = default(LabSupportProperties), string vmCreationResourceGroup = default(string), string publicIpId = default(string), string loadBalancerId = default(string), string networkSecurityGroupId = default(string), IDictionary extendedProperties = default(IDictionary), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + DefaultStorageAccount = defaultStorageAccount; + DefaultPremiumStorageAccount = defaultPremiumStorageAccount; + ArtifactsStorageAccount = artifactsStorageAccount; + PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; + VaultName = vaultName; + LabStorageType = labStorageType; + MandatoryArtifactsResourceIdsLinux = mandatoryArtifactsResourceIdsLinux; + MandatoryArtifactsResourceIdsWindows = mandatoryArtifactsResourceIdsWindows; + CreatedDate = createdDate; + PremiumDataDisks = premiumDataDisks; + EnvironmentPermission = environmentPermission; + Announcement = announcement; + Support = support; + VmCreationResourceGroup = vmCreationResourceGroup; + PublicIpId = publicIpId; + LoadBalancerId = loadBalancerId; + NetworkSecurityGroupId = networkSecurityGroupId; + ExtendedProperties = extendedProperties; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the lab's default storage account. + /// + [JsonProperty(PropertyName = "properties.defaultStorageAccount")] + public string DefaultStorageAccount { get; private set; } + + /// + /// Gets the lab's default premium storage account. + /// + [JsonProperty(PropertyName = "properties.defaultPremiumStorageAccount")] + public string DefaultPremiumStorageAccount { get; private set; } + + /// + /// Gets the lab's artifact storage account. + /// + [JsonProperty(PropertyName = "properties.artifactsStorageAccount")] + public string ArtifactsStorageAccount { get; private set; } + + /// + /// Gets the lab's premium data disk storage account. + /// + [JsonProperty(PropertyName = "properties.premiumDataDiskStorageAccount")] + public string PremiumDataDiskStorageAccount { get; private set; } + + /// + /// Gets the lab's Key vault. + /// + [JsonProperty(PropertyName = "properties.vaultName")] + public string VaultName { get; private set; } + + /// + /// Gets or sets type of storage used by the lab. It can be either + /// Premium or Standard. Default is Premium. Possible values include: + /// 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "properties.labStorageType")] + public string LabStorageType { get; set; } + + /// + /// Gets or sets the ordered list of artifact resource IDs that should + /// be applied on all Linux VM creations by default, prior to the + /// artifacts specified by the user. + /// + [JsonProperty(PropertyName = "properties.mandatoryArtifactsResourceIdsLinux")] + public IList MandatoryArtifactsResourceIdsLinux { get; set; } + + /// + /// Gets or sets the ordered list of artifact resource IDs that should + /// be applied on all Windows VM creations by default, prior to the + /// artifacts specified by the user. + /// + [JsonProperty(PropertyName = "properties.mandatoryArtifactsResourceIdsWindows")] + public IList MandatoryArtifactsResourceIdsWindows { get; set; } + + /// + /// Gets the creation date of the lab. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets or sets the setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data + /// disks is allowed. + /// When its value is 'Disabled', only creation of standard data disks + /// is allowed. Possible values include: 'Disabled', 'Enabled' + /// + [JsonProperty(PropertyName = "properties.premiumDataDisks")] + public string PremiumDataDisks { get; set; } + + /// + /// Gets or sets the access rights to be granted to the user when + /// provisioning an environment. Possible values include: 'Reader', + /// 'Contributor' + /// + [JsonProperty(PropertyName = "properties.environmentPermission")] + public string EnvironmentPermission { get; set; } + + /// + /// Gets or sets the properties of any lab announcement associated with + /// this lab + /// + [JsonProperty(PropertyName = "properties.announcement")] + public LabAnnouncementProperties Announcement { get; set; } + + /// + /// Gets or sets the properties of any lab support message associated + /// with this lab + /// + [JsonProperty(PropertyName = "properties.support")] + public LabSupportProperties Support { get; set; } + + /// + /// Gets the resource group in which lab virtual machines will be + /// created in. + /// + [JsonProperty(PropertyName = "properties.vmCreationResourceGroup")] + public string VmCreationResourceGroup { get; private set; } + + /// + /// Gets the public IP address for the lab's load balancer. + /// + [JsonProperty(PropertyName = "properties.publicIpId")] + public string PublicIpId { get; private set; } + + /// + /// Gets the load balancer used to for lab VMs that use shared IP + /// address. + /// + [JsonProperty(PropertyName = "properties.loadBalancerId")] + public string LoadBalancerId { get; private set; } + + /// + /// Gets the Network Security Group attached to the lab VMs Network + /// interfaces to restrict open ports. + /// + [JsonProperty(PropertyName = "properties.networkSecurityGroupId")] + public string NetworkSecurityGroupId { get; private set; } + + /// + /// Gets or sets extended properties of the lab used for experimental + /// features + /// + [JsonProperty(PropertyName = "properties.extendedProperties")] + public IDictionary ExtendedProperties { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementProperties.cs new file mode 100644 index 000000000000..8a2657810b8b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a lab's announcement banner + /// + public partial class LabAnnouncementProperties + { + /// + /// Initializes a new instance of the LabAnnouncementProperties class. + /// + public LabAnnouncementProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabAnnouncementProperties class. + /// + /// The plain text title for the lab + /// announcement + /// The markdown text (if any) that this lab + /// displays in the UI. If left empty/null, nothing will be + /// shown. + /// Is the lab announcement active/enabled at + /// this time?. Possible values include: 'Enabled', 'Disabled' + /// The time at which the announcement + /// expires (null for never) + /// Has this announcement expired? + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public LabAnnouncementProperties(string title = default(string), string markdown = default(string), string enabled = default(string), System.DateTime? expirationDate = default(System.DateTime?), bool? expired = default(bool?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + { + Title = title; + Markdown = markdown; + Enabled = enabled; + ExpirationDate = expirationDate; + Expired = expired; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the plain text title for the lab announcement + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// Gets or sets the markdown text (if any) that this lab displays in + /// the UI. If left empty/null, nothing will be shown. + /// + [JsonProperty(PropertyName = "markdown")] + public string Markdown { get; set; } + + /// + /// Gets or sets is the lab announcement active/enabled at this time?. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "enabled")] + public string Enabled { get; set; } + + /// + /// Gets or sets the time at which the announcement expires (null for + /// never) + /// + [JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate { get; set; } + + /// + /// Gets or sets has this announcement expired? + /// + [JsonProperty(PropertyName = "expired")] + public bool? Expired { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementPropertiesFragment.cs new file mode 100644 index 000000000000..d6ac32c27317 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementPropertiesFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a lab's announcement banner + /// + public partial class LabAnnouncementPropertiesFragment + { + /// + /// Initializes a new instance of the LabAnnouncementPropertiesFragment + /// class. + /// + public LabAnnouncementPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabAnnouncementPropertiesFragment + /// class. + /// + /// The plain text title for the lab + /// announcement + /// The markdown text (if any) that this lab + /// displays in the UI. If left empty/null, nothing will be + /// shown. + /// Is the lab announcement active/enabled at + /// this time?. Possible values include: 'Enabled', 'Disabled' + /// The time at which the announcement + /// expires (null for never) + /// Has this announcement expired? + public LabAnnouncementPropertiesFragment(string title = default(string), string markdown = default(string), string enabled = default(string), System.DateTime? expirationDate = default(System.DateTime?), bool? expired = default(bool?)) + { + Title = title; + Markdown = markdown; + Enabled = enabled; + ExpirationDate = expirationDate; + Expired = expired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the plain text title for the lab announcement + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// Gets or sets the markdown text (if any) that this lab displays in + /// the UI. If left empty/null, nothing will be shown. + /// + [JsonProperty(PropertyName = "markdown")] + public string Markdown { get; set; } + + /// + /// Gets or sets is the lab announcement active/enabled at this time?. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "enabled")] + public string Enabled { get; set; } + + /// + /// Gets or sets the time at which the announcement expires (null for + /// never) + /// + [JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate { get; set; } + + /// + /// Gets or sets has this announcement expired? + /// + [JsonProperty(PropertyName = "expired")] + public bool? Expired { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs new file mode 100644 index 000000000000..55e4b639853b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A cost item. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabCost : Resource + { + /// + /// Initializes a new instance of the LabCost class. + /// + public LabCost() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabCost class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The target cost properties + /// The lab cost summary component of the + /// cost data. + /// The lab cost details component of the + /// cost data. + /// The resource cost component of the cost + /// data. + /// The currency code of the cost. + /// The start time of the cost + /// data. + /// The end time of the cost data. + /// The creation date of the cost. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public LabCost(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), TargetCostProperties targetCost = default(TargetCostProperties), LabCostSummaryProperties labCostSummary = default(LabCostSummaryProperties), IList labCostDetails = default(IList), IList resourceCosts = default(IList), string currencyCode = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + TargetCost = targetCost; + LabCostSummary = labCostSummary; + LabCostDetails = labCostDetails; + ResourceCosts = resourceCosts; + CurrencyCode = currencyCode; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + CreatedDate = createdDate; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target cost properties + /// + [JsonProperty(PropertyName = "properties.targetCost")] + public TargetCostProperties TargetCost { get; set; } + + /// + /// Gets the lab cost summary component of the cost data. + /// + [JsonProperty(PropertyName = "properties.labCostSummary")] + public LabCostSummaryProperties LabCostSummary { get; private set; } + + /// + /// Gets the lab cost details component of the cost data. + /// + [JsonProperty(PropertyName = "properties.labCostDetails")] + public IList LabCostDetails { get; private set; } + + /// + /// Gets the resource cost component of the cost data. + /// + [JsonProperty(PropertyName = "properties.resourceCosts")] + public IList ResourceCosts { get; private set; } + + /// + /// Gets or sets the currency code of the cost. + /// + [JsonProperty(PropertyName = "properties.currencyCode")] + public string CurrencyCode { get; set; } + + /// + /// Gets or sets the start time of the cost data. + /// + [JsonProperty(PropertyName = "properties.startDateTime")] + public System.DateTime? StartDateTime { get; set; } + + /// + /// Gets or sets the end time of the cost data. + /// + [JsonProperty(PropertyName = "properties.endDateTime")] + public System.DateTime? EndDateTime { get; set; } + + /// + /// Gets or sets the creation date of the cost. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs new file mode 100644 index 000000000000..fea51529c23f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of a lab cost item. + /// + public partial class LabCostDetailsProperties + { + /// + /// Initializes a new instance of the LabCostDetailsProperties class. + /// + public LabCostDetailsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabCostDetailsProperties class. + /// + /// The date of the cost item. + /// The cost component of the cost item. + /// The type of the cost. Possible values + /// include: 'Unavailable', 'Reported', 'Projected' + public LabCostDetailsProperties(System.DateTime? date = default(System.DateTime?), double? cost = default(double?), string costType = default(string)) + { + Date = date; + Cost = cost; + CostType = costType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the date of the cost item. + /// + [JsonProperty(PropertyName = "date")] + public System.DateTime? Date { get; set; } + + /// + /// Gets or sets the cost component of the cost item. + /// + [JsonProperty(PropertyName = "cost")] + public double? Cost { get; set; } + + /// + /// Gets or sets the type of the cost. Possible values include: + /// 'Unavailable', 'Reported', 'Projected' + /// + [JsonProperty(PropertyName = "costType")] + public string CostType { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs new file mode 100644 index 000000000000..daf9adcbff0e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of the cost summary. + /// + public partial class LabCostSummaryProperties + { + /// + /// Initializes a new instance of the LabCostSummaryProperties class. + /// + public LabCostSummaryProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabCostSummaryProperties class. + /// + /// The cost component of the cost + /// item. + public LabCostSummaryProperties(double? estimatedLabCost = default(double?)) + { + EstimatedLabCost = estimatedLabCost; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the cost component of the cost item. + /// + [JsonProperty(PropertyName = "estimatedLabCost")] + public double? EstimatedLabCost { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs new file mode 100644 index 000000000000..d267fbdd502a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A lab. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabFragment : UpdateResource + { + /// + /// Initializes a new instance of the LabFragment class. + /// + public LabFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabFragment class. + /// + /// The tags of the resource. + /// Type of storage used by the lab. It + /// can be either Premium or Standard. Default is Premium. Possible + /// values include: 'Standard', 'Premium' + /// The ordered list + /// of artifact resource IDs that should be applied on all Linux VM + /// creations by default, prior to the artifacts specified by the + /// user. + /// The ordered list + /// of artifact resource IDs that should be applied on all Windows VM + /// creations by default, prior to the artifacts specified by the + /// user. + /// The setting to enable usage of + /// premium data disks. + /// When its value is 'Enabled', creation of standard or premium data + /// disks is allowed. + /// When its value is 'Disabled', only creation of standard data disks + /// is allowed. Possible values include: 'Disabled', 'Enabled' + /// The access rights to be granted + /// to the user when provisioning an environment. Possible values + /// include: 'Reader', 'Contributor' + /// The properties of any lab announcement + /// associated with this lab + /// The properties of any lab support message + /// associated with this lab + /// Extended properties of the lab + /// used for experimental features + public LabFragment(IDictionary tags = default(IDictionary), string labStorageType = default(string), IList mandatoryArtifactsResourceIdsLinux = default(IList), IList mandatoryArtifactsResourceIdsWindows = default(IList), string premiumDataDisks = default(string), string environmentPermission = default(string), LabAnnouncementPropertiesFragment announcement = default(LabAnnouncementPropertiesFragment), LabSupportPropertiesFragment support = default(LabSupportPropertiesFragment), IDictionary extendedProperties = default(IDictionary)) + : base(tags) + { + LabStorageType = labStorageType; + MandatoryArtifactsResourceIdsLinux = mandatoryArtifactsResourceIdsLinux; + MandatoryArtifactsResourceIdsWindows = mandatoryArtifactsResourceIdsWindows; + PremiumDataDisks = premiumDataDisks; + EnvironmentPermission = environmentPermission; + Announcement = announcement; + Support = support; + ExtendedProperties = extendedProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of storage used by the lab. It can be either + /// Premium or Standard. Default is Premium. Possible values include: + /// 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "properties.labStorageType")] + public string LabStorageType { get; set; } + + /// + /// Gets or sets the ordered list of artifact resource IDs that should + /// be applied on all Linux VM creations by default, prior to the + /// artifacts specified by the user. + /// + [JsonProperty(PropertyName = "properties.mandatoryArtifactsResourceIdsLinux")] + public IList MandatoryArtifactsResourceIdsLinux { get; set; } + + /// + /// Gets or sets the ordered list of artifact resource IDs that should + /// be applied on all Windows VM creations by default, prior to the + /// artifacts specified by the user. + /// + [JsonProperty(PropertyName = "properties.mandatoryArtifactsResourceIdsWindows")] + public IList MandatoryArtifactsResourceIdsWindows { get; set; } + + /// + /// Gets or sets the setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data + /// disks is allowed. + /// When its value is 'Disabled', only creation of standard data disks + /// is allowed. Possible values include: 'Disabled', 'Enabled' + /// + [JsonProperty(PropertyName = "properties.premiumDataDisks")] + public string PremiumDataDisks { get; set; } + + /// + /// Gets or sets the access rights to be granted to the user when + /// provisioning an environment. Possible values include: 'Reader', + /// 'Contributor' + /// + [JsonProperty(PropertyName = "properties.environmentPermission")] + public string EnvironmentPermission { get; set; } + + /// + /// Gets or sets the properties of any lab announcement associated with + /// this lab + /// + [JsonProperty(PropertyName = "properties.announcement")] + public LabAnnouncementPropertiesFragment Announcement { get; set; } + + /// + /// Gets or sets the properties of any lab support message associated + /// with this lab + /// + [JsonProperty(PropertyName = "properties.support")] + public LabSupportPropertiesFragment Support { get; set; } + + /// + /// Gets or sets extended properties of the lab used for experimental + /// features + /// + [JsonProperty(PropertyName = "properties.extendedProperties")] + public IDictionary ExtendedProperties { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs new file mode 100644 index 000000000000..0f86d89962d6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of a resource cost item. + /// + public partial class LabResourceCostProperties + { + /// + /// Initializes a new instance of the LabResourceCostProperties class. + /// + public LabResourceCostProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabResourceCostProperties class. + /// + /// The name of the resource. + /// The unique identifier of the + /// resource. + /// The cost component of the resource cost + /// item. + /// The logical resource type (ex. + /// virtualmachine, storageaccount) + /// The owner of the resource (ex. + /// janedoe@microsoft.com) + /// The category of the resource (ex. + /// Premium_LRS, Standard_DS1) + /// The status of the resource (ex. + /// Active) + /// The ID of the resource + /// The ID of the external + /// resource + public LabResourceCostProperties(string resourcename = default(string), string resourceUId = default(string), double? resourceCost = default(double?), string resourceType = default(string), string resourceOwner = default(string), string resourcePricingTier = default(string), string resourceStatus = default(string), string resourceId = default(string), string externalResourceId = default(string)) + { + Resourcename = resourcename; + ResourceUId = resourceUId; + ResourceCost = resourceCost; + ResourceType = resourceType; + ResourceOwner = resourceOwner; + ResourcePricingTier = resourcePricingTier; + ResourceStatus = resourceStatus; + ResourceId = resourceId; + ExternalResourceId = externalResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the resource. + /// + [JsonProperty(PropertyName = "resourcename")] + public string Resourcename { get; set; } + + /// + /// Gets or sets the unique identifier of the resource. + /// + [JsonProperty(PropertyName = "resourceUId")] + public string ResourceUId { get; set; } + + /// + /// Gets or sets the cost component of the resource cost item. + /// + [JsonProperty(PropertyName = "resourceCost")] + public double? ResourceCost { get; set; } + + /// + /// Gets or sets the logical resource type (ex. virtualmachine, + /// storageaccount) + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets or sets the owner of the resource (ex. janedoe@microsoft.com) + /// + [JsonProperty(PropertyName = "resourceOwner")] + public string ResourceOwner { get; set; } + + /// + /// Gets or sets the category of the resource (ex. Premium_LRS, + /// Standard_DS1) + /// + [JsonProperty(PropertyName = "resourcePricingTier")] + public string ResourcePricingTier { get; set; } + + /// + /// Gets or sets the status of the resource (ex. Active) + /// + [JsonProperty(PropertyName = "resourceStatus")] + public string ResourceStatus { get; set; } + + /// + /// Gets or sets the ID of the resource + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the ID of the external resource + /// + [JsonProperty(PropertyName = "externalResourceId")] + public string ExternalResourceId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportProperties.cs new file mode 100644 index 000000000000..b142870f138a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a lab's support banner + /// + public partial class LabSupportProperties + { + /// + /// Initializes a new instance of the LabSupportProperties class. + /// + public LabSupportProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabSupportProperties class. + /// + /// Is the lab support banner active/enabled at + /// this time?. Possible values include: 'Enabled', 'Disabled' + /// The markdown text (if any) that this lab + /// displays in the UI. If left empty/null, nothing will be + /// shown. + public LabSupportProperties(string enabled = default(string), string markdown = default(string)) + { + Enabled = enabled; + Markdown = markdown; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets is the lab support banner active/enabled at this + /// time?. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "enabled")] + public string Enabled { get; set; } + + /// + /// Gets or sets the markdown text (if any) that this lab displays in + /// the UI. If left empty/null, nothing will be shown. + /// + [JsonProperty(PropertyName = "markdown")] + public string Markdown { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportPropertiesFragment.cs new file mode 100644 index 000000000000..18cd11c963b8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportPropertiesFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a lab's support banner + /// + public partial class LabSupportPropertiesFragment + { + /// + /// Initializes a new instance of the LabSupportPropertiesFragment + /// class. + /// + public LabSupportPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabSupportPropertiesFragment + /// class. + /// + /// Is the lab support banner active/enabled at + /// this time?. Possible values include: 'Enabled', 'Disabled' + /// The markdown text (if any) that this lab + /// displays in the UI. If left empty/null, nothing will be + /// shown. + public LabSupportPropertiesFragment(string enabled = default(string), string markdown = default(string)) + { + Enabled = enabled; + Markdown = markdown; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets is the lab support banner active/enabled at this + /// time?. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "enabled")] + public string Enabled { get; set; } + + /// + /// Gets or sets the markdown text (if any) that this lab displays in + /// the UI. If left empty/null, nothing will be shown. + /// + [JsonProperty(PropertyName = "markdown")] + public string Markdown { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs new file mode 100644 index 000000000000..b95d812861e2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a VHD in the lab. + /// + public partial class LabVhd + { + /// + /// Initializes a new instance of the LabVhd class. + /// + public LabVhd() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVhd class. + /// + /// The URI to the VHD. + public LabVhd(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to the VHD. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs new file mode 100644 index 000000000000..e6525bc4f840 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs @@ -0,0 +1,382 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A virtual machine. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabVirtualMachine : Resource + { + /// + /// Initializes a new instance of the LabVirtualMachine class. + /// + public LabVirtualMachine() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachine class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The notes of the virtual machine. + /// The object identifier of the owner of + /// the virtual machine. + /// The user principal name of the + /// virtual machine owner. + /// The object identifier of the creator + /// of the virtual machine. + /// The email address of creator of the + /// virtual machine. + /// The creation date of the virtual + /// machine. + /// The resource identifier (Microsoft.Compute) + /// of the virtual machine. + /// The custom image identifier of the + /// virtual machine. + /// The OS type of the virtual machine. + /// The size of the virtual machine. + /// The user name of the virtual + /// machine. + /// The password of the virtual machine + /// administrator. + /// The SSH key of the virtual machine + /// administrator. + /// Indicates whether this + /// virtual machine uses an SSH key for authentication. + /// The fully-qualified domain name of the virtual + /// machine. + /// The lab subnet name of the virtual + /// machine. + /// The lab virtual network + /// identifier of the virtual machine. + /// Indicates whether the virtual + /// machine is to be created without a public IP address. + /// The artifacts to be installed on the + /// virtual machine. + /// The artifact deployment + /// status for the virtual machine. + /// The Microsoft Azure Marketplace + /// image reference of the virtual machine. + /// The id of the plan associated with the virtual + /// machine image + /// The compute virtual machine + /// properties. + /// The network interface + /// properties. + /// The applicable schedule for the + /// virtual machine. + /// The expiration date for VM. + /// Indicates whether another user can take + /// ownership of the virtual machine + /// Storage type to use for virtual machine + /// (i.e. Standard, Premium). + /// Tells source of creation + /// of lab virtual machine. Output property only. Possible values + /// include: 'FromCustomImage', 'FromGalleryImage' + /// The resource ID of the environment that + /// contains this virtual machine, if any. + /// New or existing data disks to + /// attach to the virtual machine after creation + /// Virtual Machine schedules to be + /// created + /// Last known compute power state + /// captured in DTL + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public LabVirtualMachine(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), string planId = default(string), ComputeVmProperties computeVm = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), IList dataDiskParameters = default(IList), IList scheduleParameters = default(IList), string lastKnownPowerState = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + Notes = notes; + OwnerObjectId = ownerObjectId; + OwnerUserPrincipalName = ownerUserPrincipalName; + CreatedByUserId = createdByUserId; + CreatedByUser = createdByUser; + CreatedDate = createdDate; + ComputeId = computeId; + CustomImageId = customImageId; + OsType = osType; + Size = size; + UserName = userName; + Password = password; + SshKey = sshKey; + IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + Fqdn = fqdn; + LabSubnetName = labSubnetName; + LabVirtualNetworkId = labVirtualNetworkId; + DisallowPublicIpAddress = disallowPublicIpAddress; + Artifacts = artifacts; + ArtifactDeploymentStatus = artifactDeploymentStatus; + GalleryImageReference = galleryImageReference; + PlanId = planId; + ComputeVm = computeVm; + NetworkInterface = networkInterface; + ApplicableSchedule = applicableSchedule; + ExpirationDate = expirationDate; + AllowClaim = allowClaim; + StorageType = storageType; + VirtualMachineCreationSource = virtualMachineCreationSource; + EnvironmentId = environmentId; + DataDiskParameters = dataDiskParameters; + ScheduleParameters = scheduleParameters; + LastKnownPowerState = lastKnownPowerState; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the notes of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.notes")] + public string Notes { get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId { get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName { get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId { get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser { get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// Gets or sets the resource identifier (Microsoft.Compute) of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.computeId")] + public string ComputeId { get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId { get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.size")] + public string Size { get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.userName")] + public string UserName { get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [JsonProperty(PropertyName = "properties.password")] + public string Password { get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey { get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key + /// for authentication. + /// + [JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey { get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn { get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName { get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId { get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created + /// without a public IP address. + /// + [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIpAddress { get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [JsonProperty(PropertyName = "properties.artifacts")] + public IList Artifacts { get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus { get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReference GalleryImageReference { get; set; } + + /// + /// Gets or sets the id of the plan associated with the virtual machine + /// image + /// + [JsonProperty(PropertyName = "properties.planId")] + public string PlanId { get; set; } + + /// + /// Gets the compute virtual machine properties. + /// + [JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmProperties ComputeVm { get; private set; } + + /// + /// Gets or sets the network interface properties. + /// + [JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfaceProperties NetworkInterface { get; set; } + + /// + /// Gets the applicable schedule for the virtual machine. + /// + [JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableSchedule ApplicableSchedule { get; private set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate { get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of + /// the virtual machine + /// + [JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim { get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. + /// Standard, Premium). + /// + [JsonProperty(PropertyName = "properties.storageType")] + public string StorageType { get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. + /// Output property only. Possible values include: 'FromCustomImage', + /// 'FromGalleryImage' + /// + [JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource { get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this + /// virtual machine, if any. + /// + [JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets or sets new or existing data disks to attach to the virtual + /// machine after creation + /// + [JsonProperty(PropertyName = "properties.dataDiskParameters")] + public IList DataDiskParameters { get; set; } + + /// + /// Gets or sets virtual Machine schedules to be created + /// + [JsonProperty(PropertyName = "properties.scheduleParameters")] + public IList ScheduleParameters { get; set; } + + /// + /// Gets or sets last known compute power state captured in DTL + /// + [JsonProperty(PropertyName = "properties.lastKnownPowerState")] + public string LastKnownPowerState { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs new file mode 100644 index 000000000000..3ff647fd5600 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs @@ -0,0 +1,377 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties for creating a virtual machine. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabVirtualMachineCreationParameter + { + /// + /// Initializes a new instance of the + /// LabVirtualMachineCreationParameter class. + /// + public LabVirtualMachineCreationParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LabVirtualMachineCreationParameter class. + /// + /// The number of virtual machine + /// instances to create. + /// The notes of the virtual machine. + /// The object identifier of the owner of + /// the virtual machine. + /// The user principal name of the + /// virtual machine owner. + /// The object identifier of the creator + /// of the virtual machine. + /// The email address of creator of the + /// virtual machine. + /// The creation date of the virtual + /// machine. + /// The resource identifier (Microsoft.Compute) + /// of the virtual machine. + /// The custom image identifier of the + /// virtual machine. + /// The OS type of the virtual machine. + /// The size of the virtual machine. + /// The user name of the virtual + /// machine. + /// The password of the virtual machine + /// administrator. + /// The SSH key of the virtual machine + /// administrator. + /// Indicates whether this + /// virtual machine uses an SSH key for authentication. + /// The fully-qualified domain name of the virtual + /// machine. + /// The lab subnet name of the virtual + /// machine. + /// The lab virtual network + /// identifier of the virtual machine. + /// Indicates whether the virtual + /// machine is to be created without a public IP address. + /// The artifacts to be installed on the + /// virtual machine. + /// The artifact deployment + /// status for the virtual machine. + /// The Microsoft Azure Marketplace + /// image reference of the virtual machine. + /// The id of the plan associated with the virtual + /// machine image + /// The network interface + /// properties. + /// The expiration date for VM. + /// Indicates whether another user can take + /// ownership of the virtual machine + /// Storage type to use for virtual machine + /// (i.e. Standard, Premium). + /// Tells source of creation + /// of lab virtual machine. Output property only. Possible values + /// include: 'FromCustomImage', 'FromGalleryImage' + /// The resource ID of the environment that + /// contains this virtual machine, if any. + /// New or existing data disks to + /// attach to the virtual machine after creation + /// Virtual Machine schedules to be + /// created + /// Last known compute power state + /// captured in DTL + /// The name of the virtual machine or + /// environment + /// The location of the new virtual machine or + /// environment + /// The tags of the resource. + public LabVirtualMachineCreationParameter(BulkCreationParameters bulkCreationParameters = default(BulkCreationParameters), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), string planId = default(string), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), IList dataDiskParameters = default(IList), IList scheduleParameters = default(IList), string lastKnownPowerState = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + { + BulkCreationParameters = bulkCreationParameters; + Notes = notes; + OwnerObjectId = ownerObjectId; + OwnerUserPrincipalName = ownerUserPrincipalName; + CreatedByUserId = createdByUserId; + CreatedByUser = createdByUser; + CreatedDate = createdDate; + ComputeId = computeId; + CustomImageId = customImageId; + OsType = osType; + Size = size; + UserName = userName; + Password = password; + SshKey = sshKey; + IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + Fqdn = fqdn; + LabSubnetName = labSubnetName; + LabVirtualNetworkId = labVirtualNetworkId; + DisallowPublicIpAddress = disallowPublicIpAddress; + Artifacts = artifacts; + ArtifactDeploymentStatus = artifactDeploymentStatus; + GalleryImageReference = galleryImageReference; + PlanId = planId; + NetworkInterface = networkInterface; + ExpirationDate = expirationDate; + AllowClaim = allowClaim; + StorageType = storageType; + VirtualMachineCreationSource = virtualMachineCreationSource; + EnvironmentId = environmentId; + DataDiskParameters = dataDiskParameters; + ScheduleParameters = scheduleParameters; + LastKnownPowerState = lastKnownPowerState; + Name = name; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of virtual machine instances to create. + /// + [JsonProperty(PropertyName = "properties.bulkCreationParameters")] + public BulkCreationParameters BulkCreationParameters { get; set; } + + /// + /// Gets or sets the notes of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.notes")] + public string Notes { get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId { get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName { get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId { get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser { get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// Gets or sets the resource identifier (Microsoft.Compute) of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.computeId")] + public string ComputeId { get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId { get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.size")] + public string Size { get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.userName")] + public string UserName { get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [JsonProperty(PropertyName = "properties.password")] + public string Password { get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey { get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key + /// for authentication. + /// + [JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey { get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn { get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName { get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId { get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created + /// without a public IP address. + /// + [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIpAddress { get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [JsonProperty(PropertyName = "properties.artifacts")] + public IList Artifacts { get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus { get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReference GalleryImageReference { get; set; } + + /// + /// Gets or sets the id of the plan associated with the virtual machine + /// image + /// + [JsonProperty(PropertyName = "properties.planId")] + public string PlanId { get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfaceProperties NetworkInterface { get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate { get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of + /// the virtual machine + /// + [JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim { get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. + /// Standard, Premium). + /// + [JsonProperty(PropertyName = "properties.storageType")] + public string StorageType { get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. + /// Output property only. Possible values include: 'FromCustomImage', + /// 'FromGalleryImage' + /// + [JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource { get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this + /// virtual machine, if any. + /// + [JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets or sets new or existing data disks to attach to the virtual + /// machine after creation + /// + [JsonProperty(PropertyName = "properties.dataDiskParameters")] + public IList DataDiskParameters { get; set; } + + /// + /// Gets or sets virtual Machine schedules to be created + /// + [JsonProperty(PropertyName = "properties.scheduleParameters")] + public IList ScheduleParameters { get; set; } + + /// + /// Gets or sets last known compute power state captured in DTL + /// + [JsonProperty(PropertyName = "properties.lastKnownPowerState")] + public string LastKnownPowerState { get; set; } + + /// + /// Gets or sets the name of the virtual machine or environment + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the location of the new virtual machine or environment + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the tags of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterFragment.cs new file mode 100644 index 000000000000..df4407baf182 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterFragment.cs @@ -0,0 +1,377 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties for creating a virtual machine. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabVirtualMachineCreationParameterFragment + { + /// + /// Initializes a new instance of the + /// LabVirtualMachineCreationParameterFragment class. + /// + public LabVirtualMachineCreationParameterFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LabVirtualMachineCreationParameterFragment class. + /// + /// The number of virtual machine + /// instances to create. + /// The notes of the virtual machine. + /// The object identifier of the owner of + /// the virtual machine. + /// The user principal name of the + /// virtual machine owner. + /// The object identifier of the creator + /// of the virtual machine. + /// The email address of creator of the + /// virtual machine. + /// The creation date of the virtual + /// machine. + /// The resource identifier (Microsoft.Compute) + /// of the virtual machine. + /// The custom image identifier of the + /// virtual machine. + /// The OS type of the virtual machine. + /// The size of the virtual machine. + /// The user name of the virtual + /// machine. + /// The password of the virtual machine + /// administrator. + /// The SSH key of the virtual machine + /// administrator. + /// Indicates whether this + /// virtual machine uses an SSH key for authentication. + /// The fully-qualified domain name of the virtual + /// machine. + /// The lab subnet name of the virtual + /// machine. + /// The lab virtual network + /// identifier of the virtual machine. + /// Indicates whether the virtual + /// machine is to be created without a public IP address. + /// The artifacts to be installed on the + /// virtual machine. + /// The artifact deployment + /// status for the virtual machine. + /// The Microsoft Azure Marketplace + /// image reference of the virtual machine. + /// The id of the plan associated with the virtual + /// machine image + /// The network interface + /// properties. + /// The expiration date for VM. + /// Indicates whether another user can take + /// ownership of the virtual machine + /// Storage type to use for virtual machine + /// (i.e. Standard, Premium). + /// Tells source of creation + /// of lab virtual machine. Output property only. Possible values + /// include: 'FromCustomImage', 'FromGalleryImage' + /// The resource ID of the environment that + /// contains this virtual machine, if any. + /// New or existing data disks to + /// attach to the virtual machine after creation + /// Virtual Machine schedules to be + /// created + /// Last known compute power state + /// captured in DTL + /// The name of the virtual machine or + /// environment + /// The location of the new virtual machine or + /// environment + /// The tags of the resource. + public LabVirtualMachineCreationParameterFragment(BulkCreationParametersFragment bulkCreationParameters = default(BulkCreationParametersFragment), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), string planId = default(string), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), IList dataDiskParameters = default(IList), IList scheduleParameters = default(IList), string lastKnownPowerState = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + { + BulkCreationParameters = bulkCreationParameters; + Notes = notes; + OwnerObjectId = ownerObjectId; + OwnerUserPrincipalName = ownerUserPrincipalName; + CreatedByUserId = createdByUserId; + CreatedByUser = createdByUser; + CreatedDate = createdDate; + ComputeId = computeId; + CustomImageId = customImageId; + OsType = osType; + Size = size; + UserName = userName; + Password = password; + SshKey = sshKey; + IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + Fqdn = fqdn; + LabSubnetName = labSubnetName; + LabVirtualNetworkId = labVirtualNetworkId; + DisallowPublicIpAddress = disallowPublicIpAddress; + Artifacts = artifacts; + ArtifactDeploymentStatus = artifactDeploymentStatus; + GalleryImageReference = galleryImageReference; + PlanId = planId; + NetworkInterface = networkInterface; + ExpirationDate = expirationDate; + AllowClaim = allowClaim; + StorageType = storageType; + VirtualMachineCreationSource = virtualMachineCreationSource; + EnvironmentId = environmentId; + DataDiskParameters = dataDiskParameters; + ScheduleParameters = scheduleParameters; + LastKnownPowerState = lastKnownPowerState; + Name = name; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of virtual machine instances to create. + /// + [JsonProperty(PropertyName = "properties.bulkCreationParameters")] + public BulkCreationParametersFragment BulkCreationParameters { get; set; } + + /// + /// Gets or sets the notes of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.notes")] + public string Notes { get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId { get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName { get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId { get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser { get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// Gets or sets the resource identifier (Microsoft.Compute) of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.computeId")] + public string ComputeId { get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId { get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.size")] + public string Size { get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.userName")] + public string UserName { get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [JsonProperty(PropertyName = "properties.password")] + public string Password { get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey { get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key + /// for authentication. + /// + [JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey { get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn { get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName { get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId { get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created + /// without a public IP address. + /// + [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIpAddress { get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [JsonProperty(PropertyName = "properties.artifacts")] + public IList Artifacts { get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusPropertiesFragment ArtifactDeploymentStatus { get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReferenceFragment GalleryImageReference { get; set; } + + /// + /// Gets or sets the id of the plan associated with the virtual machine + /// image + /// + [JsonProperty(PropertyName = "properties.planId")] + public string PlanId { get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfacePropertiesFragment NetworkInterface { get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate { get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of + /// the virtual machine + /// + [JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim { get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. + /// Standard, Premium). + /// + [JsonProperty(PropertyName = "properties.storageType")] + public string StorageType { get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. + /// Output property only. Possible values include: 'FromCustomImage', + /// 'FromGalleryImage' + /// + [JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource { get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this + /// virtual machine, if any. + /// + [JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets or sets new or existing data disks to attach to the virtual + /// machine after creation + /// + [JsonProperty(PropertyName = "properties.dataDiskParameters")] + public IList DataDiskParameters { get; set; } + + /// + /// Gets or sets virtual Machine schedules to be created + /// + [JsonProperty(PropertyName = "properties.scheduleParameters")] + public IList ScheduleParameters { get; set; } + + /// + /// Gets or sets last known compute power state captured in DTL + /// + [JsonProperty(PropertyName = "properties.lastKnownPowerState")] + public string LastKnownPowerState { get; set; } + + /// + /// Gets or sets the name of the virtual machine or environment + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the location of the new virtual machine or environment + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the tags of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs new file mode 100644 index 000000000000..b76a4e63da3b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A virtual machine. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabVirtualMachineFragment : UpdateResource + { + /// + /// Initializes a new instance of the LabVirtualMachineFragment class. + /// + public LabVirtualMachineFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachineFragment class. + /// + /// The tags of the resource. + /// The notes of the virtual machine. + /// The object identifier of the owner of + /// the virtual machine. + /// The user principal name of the + /// virtual machine owner. + /// The object identifier of the creator + /// of the virtual machine. + /// The email address of creator of the + /// virtual machine. + /// The creation date of the virtual + /// machine. + /// The resource identifier (Microsoft.Compute) + /// of the virtual machine. + /// The custom image identifier of the + /// virtual machine. + /// The OS type of the virtual machine. + /// The size of the virtual machine. + /// The user name of the virtual + /// machine. + /// The password of the virtual machine + /// administrator. + /// The SSH key of the virtual machine + /// administrator. + /// Indicates whether this + /// virtual machine uses an SSH key for authentication. + /// The fully-qualified domain name of the virtual + /// machine. + /// The lab subnet name of the virtual + /// machine. + /// The lab virtual network + /// identifier of the virtual machine. + /// Indicates whether the virtual + /// machine is to be created without a public IP address. + /// The artifacts to be installed on the + /// virtual machine. + /// The artifact deployment + /// status for the virtual machine. + /// The Microsoft Azure Marketplace + /// image reference of the virtual machine. + /// The id of the plan associated with the virtual + /// machine image + /// The network interface + /// properties. + /// The expiration date for VM. + /// Indicates whether another user can take + /// ownership of the virtual machine + /// Storage type to use for virtual machine + /// (i.e. Standard, Premium). + /// Tells source of creation + /// of lab virtual machine. Output property only. Possible values + /// include: 'FromCustomImage', 'FromGalleryImage' + /// The resource ID of the environment that + /// contains this virtual machine, if any. + /// New or existing data disks to + /// attach to the virtual machine after creation + /// Virtual Machine schedules to be + /// created + /// Last known compute power state + /// captured in DTL + public LabVirtualMachineFragment(IDictionary tags = default(IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), string planId = default(string), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), IList dataDiskParameters = default(IList), IList scheduleParameters = default(IList), string lastKnownPowerState = default(string)) + : base(tags) + { + Notes = notes; + OwnerObjectId = ownerObjectId; + OwnerUserPrincipalName = ownerUserPrincipalName; + CreatedByUserId = createdByUserId; + CreatedByUser = createdByUser; + CreatedDate = createdDate; + ComputeId = computeId; + CustomImageId = customImageId; + OsType = osType; + Size = size; + UserName = userName; + Password = password; + SshKey = sshKey; + IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + Fqdn = fqdn; + LabSubnetName = labSubnetName; + LabVirtualNetworkId = labVirtualNetworkId; + DisallowPublicIpAddress = disallowPublicIpAddress; + Artifacts = artifacts; + ArtifactDeploymentStatus = artifactDeploymentStatus; + GalleryImageReference = galleryImageReference; + PlanId = planId; + NetworkInterface = networkInterface; + ExpirationDate = expirationDate; + AllowClaim = allowClaim; + StorageType = storageType; + VirtualMachineCreationSource = virtualMachineCreationSource; + EnvironmentId = environmentId; + DataDiskParameters = dataDiskParameters; + ScheduleParameters = scheduleParameters; + LastKnownPowerState = lastKnownPowerState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the notes of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.notes")] + public string Notes { get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId { get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName { get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId { get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser { get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// Gets or sets the resource identifier (Microsoft.Compute) of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.computeId")] + public string ComputeId { get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId { get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.size")] + public string Size { get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.userName")] + public string UserName { get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [JsonProperty(PropertyName = "properties.password")] + public string Password { get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey { get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key + /// for authentication. + /// + [JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey { get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn { get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName { get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId { get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created + /// without a public IP address. + /// + [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIpAddress { get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [JsonProperty(PropertyName = "properties.artifacts")] + public IList Artifacts { get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusPropertiesFragment ArtifactDeploymentStatus { get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReferenceFragment GalleryImageReference { get; set; } + + /// + /// Gets or sets the id of the plan associated with the virtual machine + /// image + /// + [JsonProperty(PropertyName = "properties.planId")] + public string PlanId { get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfacePropertiesFragment NetworkInterface { get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate { get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of + /// the virtual machine + /// + [JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim { get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. + /// Standard, Premium). + /// + [JsonProperty(PropertyName = "properties.storageType")] + public string StorageType { get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. + /// Output property only. Possible values include: 'FromCustomImage', + /// 'FromGalleryImage' + /// + [JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource { get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this + /// virtual machine, if any. + /// + [JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets or sets new or existing data disks to attach to the virtual + /// machine after creation + /// + [JsonProperty(PropertyName = "properties.dataDiskParameters")] + public IList DataDiskParameters { get; set; } + + /// + /// Gets or sets virtual Machine schedules to be created + /// + [JsonProperty(PropertyName = "properties.scheduleParameters")] + public IList ScheduleParameters { get; set; } + + /// + /// Gets or sets last known compute power state captured in DTL + /// + [JsonProperty(PropertyName = "properties.lastKnownPowerState")] + public string LastKnownPowerState { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs new file mode 100644 index 000000000000..cdd1c1023010 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a Linux OS. + /// + public partial class LinuxOsInfo + { + /// + /// Initializes a new instance of the LinuxOsInfo class. + /// + public LinuxOsInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxOsInfo class. + /// + /// The state of the Linux OS (i.e. + /// NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). + /// Possible values include: 'NonDeprovisioned', + /// 'DeprovisionRequested', 'DeprovisionApplied' + public LinuxOsInfo(string linuxOsState = default(string)) + { + LinuxOsState = linuxOsState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of the Linux OS (i.e. NonDeprovisioned, + /// DeprovisionRequested, DeprovisionApplied). Possible values include: + /// 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' + /// + [JsonProperty(PropertyName = "linuxOsState")] + public string LinuxOsState { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfoFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfoFragment.cs new file mode 100644 index 000000000000..fdd6ba5aba99 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfoFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a Linux OS. + /// + public partial class LinuxOsInfoFragment + { + /// + /// Initializes a new instance of the LinuxOsInfoFragment class. + /// + public LinuxOsInfoFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxOsInfoFragment class. + /// + /// The state of the Linux OS (i.e. + /// NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). + /// Possible values include: 'NonDeprovisioned', + /// 'DeprovisionRequested', 'DeprovisionApplied' + public LinuxOsInfoFragment(string linuxOsState = default(string)) + { + LinuxOsState = linuxOsState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of the Linux OS (i.e. NonDeprovisioned, + /// DeprovisionRequested, DeprovisionApplied). Possible values include: + /// 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' + /// + [JsonProperty(PropertyName = "linuxOsState")] + public string LinuxOsState { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs new file mode 100644 index 000000000000..2c5212fbb8ab --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.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.DevTestLabs.Models +{ + + /// + /// Defines values for LinuxOsState. + /// + public static class LinuxOsState + { + public const string NonDeprovisioned = "NonDeprovisioned"; + public const string DeprovisionRequested = "DeprovisionRequested"; + public const string DeprovisionApplied = "DeprovisionApplied"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs new file mode 100644 index 000000000000..af26330b86bd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a network interface. + /// + public partial class NetworkInterfaceProperties + { + /// + /// Initializes a new instance of the NetworkInterfaceProperties class. + /// + public NetworkInterfaceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkInterfaceProperties class. + /// + /// The resource ID of the virtual + /// network. + /// The resource ID of the sub net. + /// The resource ID of the public IP + /// address. + /// The public IP address. + /// The private IP address. + /// The DNS name. + /// The RdpAuthority property is a server + /// DNS host name or IP address followed by the service port number for + /// RDP (Remote Desktop Protocol). + /// The SshAuthority property is a server + /// DNS host name or IP address followed by the service port number for + /// SSH. + /// The configuration + /// for sharing a public IP address across multiple virtual + /// machines. + public NetworkInterfaceProperties(string virtualNetworkId = default(string), string subnetId = default(string), string publicIpAddressId = default(string), string publicIpAddress = default(string), string privateIpAddress = default(string), string dnsName = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), SharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration = default(SharedPublicIpAddressConfiguration)) + { + VirtualNetworkId = virtualNetworkId; + SubnetId = subnetId; + PublicIpAddressId = publicIpAddressId; + PublicIpAddress = publicIpAddress; + PrivateIpAddress = privateIpAddress; + DnsName = dnsName; + RdpAuthority = rdpAuthority; + SshAuthority = sshAuthority; + SharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the virtual network. + /// + [JsonProperty(PropertyName = "virtualNetworkId")] + public string VirtualNetworkId { get; set; } + + /// + /// Gets or sets the resource ID of the sub net. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets the resource ID of the public IP address. + /// + [JsonProperty(PropertyName = "publicIpAddressId")] + public string PublicIpAddressId { get; set; } + + /// + /// Gets or sets the public IP address. + /// + [JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIpAddress { get; set; } + + /// + /// Gets or sets the private IP address. + /// + [JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIpAddress { get; set; } + + /// + /// Gets or sets the DNS name. + /// + [JsonProperty(PropertyName = "dnsName")] + public string DnsName { get; set; } + + /// + /// Gets or sets the RdpAuthority property is a server DNS host name or + /// IP address followed by the service port number for RDP (Remote + /// Desktop Protocol). + /// + [JsonProperty(PropertyName = "rdpAuthority")] + public string RdpAuthority { get; set; } + + /// + /// Gets or sets the SshAuthority property is a server DNS host name or + /// IP address followed by the service port number for SSH. + /// + [JsonProperty(PropertyName = "sshAuthority")] + public string SshAuthority { get; set; } + + /// + /// Gets or sets the configuration for sharing a public IP address + /// across multiple virtual machines. + /// + [JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SharedPublicIpAddressConfiguration SharedPublicIpAddressConfiguration { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs new file mode 100644 index 000000000000..e790d77f8f65 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a network interface. + /// + public partial class NetworkInterfacePropertiesFragment + { + /// + /// Initializes a new instance of the + /// NetworkInterfacePropertiesFragment class. + /// + public NetworkInterfacePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// NetworkInterfacePropertiesFragment class. + /// + /// The resource ID of the virtual + /// network. + /// The resource ID of the sub net. + /// The resource ID of the public IP + /// address. + /// The public IP address. + /// The private IP address. + /// The DNS name. + /// The RdpAuthority property is a server + /// DNS host name or IP address followed by the service port number for + /// RDP (Remote Desktop Protocol). + /// The SshAuthority property is a server + /// DNS host name or IP address followed by the service port number for + /// SSH. + /// The configuration + /// for sharing a public IP address across multiple virtual + /// machines. + public NetworkInterfacePropertiesFragment(string virtualNetworkId = default(string), string subnetId = default(string), string publicIpAddressId = default(string), string publicIpAddress = default(string), string privateIpAddress = default(string), string dnsName = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), SharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration = default(SharedPublicIpAddressConfigurationFragment)) + { + VirtualNetworkId = virtualNetworkId; + SubnetId = subnetId; + PublicIpAddressId = publicIpAddressId; + PublicIpAddress = publicIpAddress; + PrivateIpAddress = privateIpAddress; + DnsName = dnsName; + RdpAuthority = rdpAuthority; + SshAuthority = sshAuthority; + SharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the virtual network. + /// + [JsonProperty(PropertyName = "virtualNetworkId")] + public string VirtualNetworkId { get; set; } + + /// + /// Gets or sets the resource ID of the sub net. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets the resource ID of the public IP address. + /// + [JsonProperty(PropertyName = "publicIpAddressId")] + public string PublicIpAddressId { get; set; } + + /// + /// Gets or sets the public IP address. + /// + [JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIpAddress { get; set; } + + /// + /// Gets or sets the private IP address. + /// + [JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIpAddress { get; set; } + + /// + /// Gets or sets the DNS name. + /// + [JsonProperty(PropertyName = "dnsName")] + public string DnsName { get; set; } + + /// + /// Gets or sets the RdpAuthority property is a server DNS host name or + /// IP address followed by the service port number for RDP (Remote + /// Desktop Protocol). + /// + [JsonProperty(PropertyName = "rdpAuthority")] + public string RdpAuthority { get; set; } + + /// + /// Gets or sets the SshAuthority property is a server DNS host name or + /// IP address followed by the service port number for SSH. + /// + [JsonProperty(PropertyName = "sshAuthority")] + public string SshAuthority { get; set; } + + /// + /// Gets or sets the configuration for sharing a public IP address + /// across multiple virtual machines. + /// + [JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SharedPublicIpAddressConfigurationFragment SharedPublicIpAddressConfiguration { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs new file mode 100644 index 000000000000..99644eb038a2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A notification. + /// + [Rest.Serialization.JsonTransformation] + public partial class NotificationChannel : Resource + { + /// + /// Initializes a new instance of the NotificationChannel class. + /// + public NotificationChannel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationChannel class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The webhook URL to send notifications + /// to. + /// The email recipient to send + /// notifications to (can be a list of semi-colon seperated email + /// addresses). + /// The locale to use when sending a + /// notification (fallback for unsupported languages is EN). + /// Description of notification. + /// The list of event for which this notification + /// is enabled. + /// The creation date of the notification + /// channel. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public NotificationChannel(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string webHookUrl = default(string), string emailRecipient = default(string), string notificationLocale = default(string), string description = default(string), IList events = default(IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + WebHookUrl = webHookUrl; + EmailRecipient = emailRecipient; + NotificationLocale = notificationLocale; + Description = description; + Events = events; + CreatedDate = createdDate; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the webhook URL to send notifications to. + /// + [JsonProperty(PropertyName = "properties.webHookUrl")] + public string WebHookUrl { get; set; } + + /// + /// Gets or sets the email recipient to send notifications to (can be a + /// list of semi-colon seperated email addresses). + /// + [JsonProperty(PropertyName = "properties.emailRecipient")] + public string EmailRecipient { get; set; } + + /// + /// Gets or sets the locale to use when sending a notification + /// (fallback for unsupported languages is EN). + /// + [JsonProperty(PropertyName = "properties.notificationLocale")] + public string NotificationLocale { get; set; } + + /// + /// Gets or sets description of notification. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the list of event for which this notification is + /// enabled. + /// + [JsonProperty(PropertyName = "properties.events")] + public IList Events { get; set; } + + /// + /// Gets the creation date of the notification channel. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs new file mode 100644 index 000000000000..abe6a61224b5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.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.DevTestLabs.Models +{ + + /// + /// Defines values for NotificationChannelEventType. + /// + public static class NotificationChannelEventType + { + public const string AutoShutdown = "AutoShutdown"; + public const string Cost = "Cost"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs new file mode 100644 index 000000000000..c5b9f4b87259 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A notification. + /// + [Rest.Serialization.JsonTransformation] + public partial class NotificationChannelFragment : UpdateResource + { + /// + /// Initializes a new instance of the NotificationChannelFragment + /// class. + /// + public NotificationChannelFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationChannelFragment + /// class. + /// + /// The tags of the resource. + /// The webhook URL to send notifications + /// to. + /// The email recipient to send + /// notifications to (can be a list of semi-colon seperated email + /// addresses). + /// The locale to use when sending a + /// notification (fallback for unsupported languages is EN). + /// Description of notification. + /// The list of event for which this notification + /// is enabled. + public NotificationChannelFragment(IDictionary tags = default(IDictionary), string webHookUrl = default(string), string emailRecipient = default(string), string notificationLocale = default(string), string description = default(string), IList events = default(IList)) + : base(tags) + { + WebHookUrl = webHookUrl; + EmailRecipient = emailRecipient; + NotificationLocale = notificationLocale; + Description = description; + Events = events; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the webhook URL to send notifications to. + /// + [JsonProperty(PropertyName = "properties.webHookUrl")] + public string WebHookUrl { get; set; } + + /// + /// Gets or sets the email recipient to send notifications to (can be a + /// list of semi-colon seperated email addresses). + /// + [JsonProperty(PropertyName = "properties.emailRecipient")] + public string EmailRecipient { get; set; } + + /// + /// Gets or sets the locale to use when sending a notification + /// (fallback for unsupported languages is EN). + /// + [JsonProperty(PropertyName = "properties.notificationLocale")] + public string NotificationLocale { get; set; } + + /// + /// Gets or sets description of notification. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the list of event for which this notification is + /// enabled. + /// + [JsonProperty(PropertyName = "properties.events")] + public IList Events { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs new file mode 100644 index 000000000000..cdc145cc5a1b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Notification settings for a schedule. + /// + public partial class NotificationSettings + { + /// + /// Initializes a new instance of the NotificationSettings class. + /// + public NotificationSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationSettings class. + /// + /// If notifications are enabled for this schedule + /// (i.e. Enabled, Disabled). Possible values include: 'Enabled', + /// 'Disabled' + /// Time in minutes before event at which + /// notification will be sent. + /// The webhook URL to which the notification + /// will be sent. + /// The email recipient to send + /// notifications to (can be a list of semi-colon seperated email + /// addresses). + /// The locale to use when sending a + /// notification (fallback for unsupported languages is EN). + public NotificationSettings(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string), string emailRecipient = default(string), string notificationLocale = default(string)) + { + Status = status; + TimeInMinutes = timeInMinutes; + WebhookUrl = webhookUrl; + EmailRecipient = emailRecipient; + NotificationLocale = notificationLocale; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if notifications are enabled for this schedule (i.e. + /// Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets time in minutes before event at which notification + /// will be sent. + /// + [JsonProperty(PropertyName = "timeInMinutes")] + public int? TimeInMinutes { get; set; } + + /// + /// Gets or sets the webhook URL to which the notification will be + /// sent. + /// + [JsonProperty(PropertyName = "webhookUrl")] + public string WebhookUrl { get; set; } + + /// + /// Gets or sets the email recipient to send notifications to (can be a + /// list of semi-colon seperated email addresses). + /// + [JsonProperty(PropertyName = "emailRecipient")] + public string EmailRecipient { get; set; } + + /// + /// Gets or sets the locale to use when sending a notification + /// (fallback for unsupported languages is EN). + /// + [JsonProperty(PropertyName = "notificationLocale")] + public string NotificationLocale { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs new file mode 100644 index 000000000000..eaae0283bef2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Notification settings for a schedule. + /// + public partial class NotificationSettingsFragment + { + /// + /// Initializes a new instance of the NotificationSettingsFragment + /// class. + /// + public NotificationSettingsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationSettingsFragment + /// class. + /// + /// If notifications are enabled for this schedule + /// (i.e. Enabled, Disabled). Possible values include: 'Enabled', + /// 'Disabled' + /// Time in minutes before event at which + /// notification will be sent. + /// The webhook URL to which the notification + /// will be sent. + /// The email recipient to send + /// notifications to (can be a list of semi-colon seperated email + /// addresses). + /// The locale to use when sending a + /// notification (fallback for unsupported languages is EN). + public NotificationSettingsFragment(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string), string emailRecipient = default(string), string notificationLocale = default(string)) + { + Status = status; + TimeInMinutes = timeInMinutes; + WebhookUrl = webhookUrl; + EmailRecipient = emailRecipient; + NotificationLocale = notificationLocale; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if notifications are enabled for this schedule (i.e. + /// Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets time in minutes before event at which notification + /// will be sent. + /// + [JsonProperty(PropertyName = "timeInMinutes")] + public int? TimeInMinutes { get; set; } + + /// + /// Gets or sets the webhook URL to which the notification will be + /// sent. + /// + [JsonProperty(PropertyName = "webhookUrl")] + public string WebhookUrl { get; set; } + + /// + /// Gets or sets the email recipient to send notifications to (can be a + /// list of semi-colon seperated email addresses). + /// + [JsonProperty(PropertyName = "emailRecipient")] + public string EmailRecipient { get; set; } + + /// + /// Gets or sets the locale to use when sending a notification + /// (fallback for unsupported languages is EN). + /// + [JsonProperty(PropertyName = "notificationLocale")] + public string NotificationLocale { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs new file mode 100644 index 000000000000..973474b1ece8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for generating a Notification. + /// + public partial class NotifyParameters + { + /// + /// Initializes a new instance of the NotifyParameters class. + /// + public NotifyParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotifyParameters class. + /// + /// The type of event (i.e. AutoShutdown, + /// Cost). Possible values include: 'AutoShutdown', 'Cost' + /// Properties for the notification in json + /// format. + public NotifyParameters(string eventName = default(string), string jsonPayload = default(string)) + { + EventName = eventName; + JsonPayload = jsonPayload; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of event (i.e. AutoShutdown, Cost). Possible + /// values include: 'AutoShutdown', 'Cost' + /// + [JsonProperty(PropertyName = "eventName")] + public string EventName { get; set; } + + /// + /// Gets or sets properties for the notification in json format. + /// + [JsonProperty(PropertyName = "jsonPayload")] + public string JsonPayload { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs new file mode 100644 index 000000000000..7fd87aa1d96c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details for the operation in case of a failure. + /// + public partial class OperationError + { + /// + /// Initializes a new instance of the OperationError class. + /// + public OperationError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationError class. + /// + /// The error code of the operation error. + /// The error message of the operation + /// error. + public OperationError(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error code of the operation error. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message of the operation error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs new file mode 100644 index 000000000000..8a637cbc3dde --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The REST API operation supported by DevTestLab ResourceProvider. + /// + public partial class OperationMetadata + { + /// + /// Initializes a new instance of the OperationMetadata class. + /// + public OperationMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationMetadata class. + /// + /// Operation name: + /// {provider}/{resource}/{operation} + /// The object that describes the + /// operations + public OperationMetadata(string name = default(string), OperationMetadataDisplay display = default(OperationMetadataDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation name: {provider}/{resource}/{operation} + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the object that describes the operations + /// + [JsonProperty(PropertyName = "display")] + public OperationMetadataDisplay Display { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs new file mode 100644 index 000000000000..98bae28c96c3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object that describes the operations + /// + public partial class OperationMetadataDisplay + { + /// + /// Initializes a new instance of the OperationMetadataDisplay class. + /// + public OperationMetadataDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationMetadataDisplay class. + /// + /// Friendly name of the resource + /// provider + /// Resource type on which the operation is + /// performed. + /// Operation type: read, write, delete, + /// listKeys/action, etc. + /// Friendly name of the operation + public OperationMetadataDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets friendly name of the resource provider + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource type on which the operation is performed. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets operation type: read, write, delete, listKeys/action, + /// etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets friendly name of the operation + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs new file mode 100644 index 000000000000..7b0099cbe817 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Operation Result + /// + public partial class OperationResult + { + /// + /// Initializes a new instance of the OperationResult class. + /// + public OperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResult class. + /// + /// The operation status. + /// The status code for the operation. + /// Possible values include: 'Continue', 'SwitchingProtocols', 'OK', + /// 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', + /// 'ResetContent', 'PartialContent', 'MultipleChoices', + /// 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', + /// 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', + /// 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', + /// 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', + /// 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', + /// 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', + /// 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', + /// 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', + /// 'NotImplemented', 'BadGateway', 'ServiceUnavailable', + /// 'GatewayTimeout', 'HttpVersionNotSupported' + /// Error details for the operation in case of a + /// failure. + public OperationResult(string status = default(string), string statusCode = default(string), OperationError error = default(OperationError)) + { + Status = status; + StatusCode = statusCode; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operation status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the status code for the operation. Possible values + /// include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', + /// 'Accepted', 'NonAuthoritativeInformation', 'NoContent', + /// 'ResetContent', 'PartialContent', 'MultipleChoices', + /// 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', + /// 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', + /// 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', + /// 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', + /// 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', + /// 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', + /// 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', + /// 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', + /// 'NotImplemented', 'BadGateway', 'ServiceUnavailable', + /// 'GatewayTimeout', 'HttpVersionNotSupported' + /// + [JsonProperty(PropertyName = "statusCode")] + public string StatusCode { get; set; } + + /// + /// Gets or sets error details for the operation in case of a failure. + /// + [JsonProperty(PropertyName = "error")] + public OperationError Error { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..132d59834ce1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.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.DevTestLabs.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("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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs new file mode 100644 index 000000000000..2a030f059c37 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about an artifact's parameter. + /// + public partial class ParameterInfo + { + /// + /// Initializes a new instance of the ParameterInfo class. + /// + public ParameterInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ParameterInfo class. + /// + /// The name of the artifact parameter. + /// The value of the artifact parameter. + public ParameterInfo(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 artifact parameter. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the artifact parameter. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs new file mode 100644 index 000000000000..6db9a1fe0248 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A file containing a set of parameter values for an ARM template. + /// + public partial class ParametersValueFileInfo + { + /// + /// Initializes a new instance of the ParametersValueFileInfo class. + /// + public ParametersValueFileInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ParametersValueFileInfo class. + /// + /// File name. + /// Contents of the file. + public ParametersValueFileInfo(string fileName = default(string), object parametersValueInfo = default(object)) + { + FileName = fileName; + ParametersValueInfo = parametersValueInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets file name. + /// + [JsonProperty(PropertyName = "fileName")] + public string FileName { get; set; } + + /// + /// Gets or sets contents of the file. + /// + [JsonProperty(PropertyName = "parametersValueInfo")] + public object ParametersValueInfo { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs new file mode 100644 index 000000000000..8e3bb0efb8c3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a percentage cost threshold. + /// + public partial class PercentageCostThresholdProperties + { + /// + /// Initializes a new instance of the PercentageCostThresholdProperties + /// class. + /// + public PercentageCostThresholdProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PercentageCostThresholdProperties + /// class. + /// + /// The cost threshold value. + public PercentageCostThresholdProperties(double? thresholdValue = default(double?)) + { + ThresholdValue = thresholdValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the cost threshold value. + /// + [JsonProperty(PropertyName = "thresholdValue")] + public double? ThresholdValue { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs new file mode 100644 index 000000000000..bb50ec14a072 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs @@ -0,0 +1,148 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class Policy : Resource + { + /// + /// Initializes a new instance of the Policy class. + /// + public Policy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Policy class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The description of the policy. + /// The status of the policy. Possible values + /// include: 'Enabled', 'Disabled' + /// The fact name of the policy (e.g. + /// LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values + /// include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', + /// 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', + /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost', + /// 'EnvironmentTemplate', 'ScheduleEditPermission' + /// The fact data of the policy. + /// The threshold of the policy (i.e. a number + /// for MaxValuePolicy, and a JSON array of values for + /// AllowedValuesPolicy). + /// The evaluator type of the policy (i.e. + /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: + /// 'AllowedValuesPolicy', 'MaxValuePolicy' + /// The creation date of the policy. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public Policy(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + Description = description; + Status = status; + FactName = factName; + FactData = factData; + Threshold = threshold; + EvaluatorType = evaluatorType; + CreatedDate = createdDate; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of the policy. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the status of the policy. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the fact name of the policy (e.g. LabVmCount, + /// LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: + /// 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', + /// 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', + /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost', + /// 'EnvironmentTemplate', 'ScheduleEditPermission' + /// + [JsonProperty(PropertyName = "properties.factName")] + public string FactName { get; set; } + + /// + /// Gets or sets the fact data of the policy. + /// + [JsonProperty(PropertyName = "properties.factData")] + public string FactData { get; set; } + + /// + /// Gets or sets the threshold of the policy (i.e. a number for + /// MaxValuePolicy, and a JSON array of values for + /// AllowedValuesPolicy). + /// + [JsonProperty(PropertyName = "properties.threshold")] + public string Threshold { get; set; } + + /// + /// Gets or sets the evaluator type of the policy (i.e. + /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: + /// 'AllowedValuesPolicy', 'MaxValuePolicy' + /// + [JsonProperty(PropertyName = "properties.evaluatorType")] + public string EvaluatorType { get; set; } + + /// + /// Gets the creation date of the policy. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs new file mode 100644 index 000000000000..a4eb10ab44f0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.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.DevTestLabs.Models +{ + + /// + /// Defines values for PolicyEvaluatorType. + /// + public static class PolicyEvaluatorType + { + public const string AllowedValuesPolicy = "AllowedValuesPolicy"; + public const string MaxValuePolicy = "MaxValuePolicy"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs new file mode 100644 index 000000000000..fea7e30b6e61 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.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.DevTestLabs.Models +{ + + /// + /// Defines values for PolicyFactName. + /// + public static class PolicyFactName + { + public const string UserOwnedLabVmCount = "UserOwnedLabVmCount"; + public const string UserOwnedLabPremiumVmCount = "UserOwnedLabPremiumVmCount"; + public const string LabVmCount = "LabVmCount"; + public const string LabPremiumVmCount = "LabPremiumVmCount"; + public const string LabVmSize = "LabVmSize"; + public const string GalleryImage = "GalleryImage"; + public const string UserOwnedLabVmCountInSubnet = "UserOwnedLabVmCountInSubnet"; + public const string LabTargetCost = "LabTargetCost"; + public const string EnvironmentTemplate = "EnvironmentTemplate"; + public const string ScheduleEditPermission = "ScheduleEditPermission"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs new file mode 100644 index 000000000000..020c1526165d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class PolicyFragment : UpdateResource + { + /// + /// Initializes a new instance of the PolicyFragment class. + /// + public PolicyFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyFragment class. + /// + /// The tags of the resource. + /// The description of the policy. + /// The status of the policy. Possible values + /// include: 'Enabled', 'Disabled' + /// The fact name of the policy (e.g. + /// LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values + /// include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', + /// 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', + /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost', + /// 'EnvironmentTemplate', 'ScheduleEditPermission' + /// The fact data of the policy. + /// The threshold of the policy (i.e. a number + /// for MaxValuePolicy, and a JSON array of values for + /// AllowedValuesPolicy). + /// The evaluator type of the policy (i.e. + /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: + /// 'AllowedValuesPolicy', 'MaxValuePolicy' + public PolicyFragment(IDictionary tags = default(IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string)) + : base(tags) + { + Description = description; + Status = status; + FactName = factName; + FactData = factData; + Threshold = threshold; + EvaluatorType = evaluatorType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of the policy. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the status of the policy. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the fact name of the policy (e.g. LabVmCount, + /// LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: + /// 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', + /// 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', + /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost', + /// 'EnvironmentTemplate', 'ScheduleEditPermission' + /// + [JsonProperty(PropertyName = "properties.factName")] + public string FactName { get; set; } + + /// + /// Gets or sets the fact data of the policy. + /// + [JsonProperty(PropertyName = "properties.factData")] + public string FactData { get; set; } + + /// + /// Gets or sets the threshold of the policy (i.e. a number for + /// MaxValuePolicy, and a JSON array of values for + /// AllowedValuesPolicy). + /// + [JsonProperty(PropertyName = "properties.threshold")] + public string Threshold { get; set; } + + /// + /// Gets or sets the evaluator type of the policy (i.e. + /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: + /// 'AllowedValuesPolicy', 'MaxValuePolicy' + /// + [JsonProperty(PropertyName = "properties.evaluatorType")] + public string EvaluatorType { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs new file mode 100644 index 000000000000..d4ce94a02670 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of a policy set evaluation. + /// + public partial class PolicySetResult + { + /// + /// Initializes a new instance of the PolicySetResult class. + /// + public PolicySetResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicySetResult class. + /// + /// A value indicating whether this policy set + /// evaluation has discovered violations. + /// The list of policy + /// violations. + public PolicySetResult(bool? hasError = default(bool?), IList policyViolations = default(IList)) + { + HasError = hasError; + PolicyViolations = policyViolations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a value indicating whether this policy set evaluation + /// has discovered violations. + /// + [JsonProperty(PropertyName = "hasError")] + public bool? HasError { get; set; } + + /// + /// Gets or sets the list of policy violations. + /// + [JsonProperty(PropertyName = "policyViolations")] + public IList PolicyViolations { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs new file mode 100644 index 000000000000..be2760e1856e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.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.DevTestLabs.Models +{ + + /// + /// Defines values for PolicyStatus. + /// + public static class PolicyStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs new file mode 100644 index 000000000000..a2dcac6def61 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Policy violation. + /// + public partial class PolicyViolation + { + /// + /// Initializes a new instance of the PolicyViolation class. + /// + public PolicyViolation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyViolation class. + /// + /// The code of the policy violation. + /// The message of the policy violation. + public PolicyViolation(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the code of the policy violation. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the message of the policy violation. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs new file mode 100644 index 000000000000..952dfaa69635 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a network port. + /// + public partial class Port + { + /// + /// Initializes a new instance of the Port class. + /// + public Port() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Port class. + /// + /// Protocol type of the port. Possible + /// values include: 'Tcp', 'Udp' + /// Backend port of the target virtual + /// machine. + public Port(string transportProtocol = default(string), int? backendPort = default(int?)) + { + TransportProtocol = transportProtocol; + BackendPort = backendPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets protocol type of the port. Possible values include: + /// 'Tcp', 'Udp' + /// + [JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol { get; set; } + + /// + /// Gets or sets backend port of the target virtual machine. + /// + [JsonProperty(PropertyName = "backendPort")] + public int? BackendPort { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs new file mode 100644 index 000000000000..ccf98f72fa22 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a network port. + /// + public partial class PortFragment + { + /// + /// Initializes a new instance of the PortFragment class. + /// + public PortFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortFragment class. + /// + /// Protocol type of the port. Possible + /// values include: 'Tcp', 'Udp' + /// Backend port of the target virtual + /// machine. + public PortFragment(string transportProtocol = default(string), int? backendPort = default(int?)) + { + TransportProtocol = transportProtocol; + BackendPort = backendPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets protocol type of the port. Possible values include: + /// 'Tcp', 'Udp' + /// + [JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol { get; set; } + + /// + /// Gets or sets backend port of the target virtual machine. + /// + [JsonProperty(PropertyName = "backendPort")] + public int? BackendPort { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs new file mode 100644 index 000000000000..93be3e948363 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.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.DevTestLabs.Models +{ + + /// + /// Defines values for PremiumDataDisk. + /// + public static class PremiumDataDisk + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RdpConnection.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RdpConnection.cs new file mode 100644 index 000000000000..54b763facfe3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RdpConnection.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a .rdp file + /// + public partial class RdpConnection + { + /// + /// Initializes a new instance of the RdpConnection class. + /// + public RdpConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RdpConnection class. + /// + /// The contents of the .rdp file + public RdpConnection(string contents = default(string)) + { + Contents = contents; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the contents of the .rdp file + /// + [JsonProperty(PropertyName = "contents")] + public string Contents { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs new file mode 100644 index 000000000000..d4b5a9a92876 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.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.DevTestLabs.Models +{ + + /// + /// Defines values for ReportingCycleType. + /// + public static class ReportingCycleType + { + public const string CalendarMonth = "CalendarMonth"; + public const string Custom = "Custom"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ResizeLabVirtualMachineProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ResizeLabVirtualMachineProperties.cs new file mode 100644 index 000000000000..3cfe6de3c77b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ResizeLabVirtualMachineProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Request body for resizing a virtual machine. + /// + public partial class ResizeLabVirtualMachineProperties + { + /// + /// Initializes a new instance of the ResizeLabVirtualMachineProperties + /// class. + /// + public ResizeLabVirtualMachineProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResizeLabVirtualMachineProperties + /// class. + /// + /// Specifies the size of the virtual + /// machine. + public ResizeLabVirtualMachineProperties(string size = default(string)) + { + Size = size; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the size of the virtual machine. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs new file mode 100644 index 000000000000..065a5d37a329 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Azure resource. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + public Resource(string id = default(string), string name = default(string), string type = default(string), string location = 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 the identifier of the resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the tags of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs new file mode 100644 index 000000000000..dc97ef5917aa --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for retargeting a virtual machine schedule. + /// + public partial class RetargetScheduleProperties + { + /// + /// Initializes a new instance of the RetargetScheduleProperties class. + /// + public RetargetScheduleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RetargetScheduleProperties class. + /// + /// The resource Id of the virtual + /// machine on which the schedule operates + /// The resource Id of the virtual + /// machine that the schedule should be retargeted to + public RetargetScheduleProperties(string currentResourceId = default(string), string targetResourceId = default(string)) + { + CurrentResourceId = currentResourceId; + TargetResourceId = targetResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource Id of the virtual machine on which the + /// schedule operates + /// + [JsonProperty(PropertyName = "currentResourceId")] + public string CurrentResourceId { get; set; } + + /// + /// Gets or sets the resource Id of the virtual machine that the + /// schedule should be retargeted to + /// + [JsonProperty(PropertyName = "targetResourceId")] + public string TargetResourceId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs new file mode 100644 index 000000000000..9fea2adcb9ac --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs @@ -0,0 +1,157 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A schedule. + /// + [Rest.Serialization.JsonTransformation] + public partial class Schedule : Resource + { + /// + /// Initializes a new instance of the Schedule class. + /// + public Schedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Schedule class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The status of the schedule (i.e. Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// The task type of the schedule (e.g. + /// LabVmsShutdownTask, LabVmAutoStart). + /// If the schedule will occur only some + /// days of the week, specify the weekly recurrence. + /// If the schedule will occur once each + /// day of the week, specify the daily recurrence. + /// If the schedule will occur multiple + /// times a day, specify the hourly recurrence. + /// The time zone ID (e.g. Pacific Standard + /// time). + /// Notification settings. + /// The creation date of the + /// schedule. + /// The resource ID to which the + /// schedule belongs + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public Schedule(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), NotificationSettings notificationSettings = default(NotificationSettings), System.DateTime? createdDate = default(System.DateTime?), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + Status = status; + TaskType = taskType; + WeeklyRecurrence = weeklyRecurrence; + DailyRecurrence = dailyRecurrence; + HourlyRecurrence = hourlyRecurrence; + TimeZoneId = timeZoneId; + NotificationSettings = notificationSettings; + CreatedDate = createdDate; + TargetResourceId = targetResourceId; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. + /// LabVmsShutdownTask, LabVmAutoStart). + /// + [JsonProperty(PropertyName = "properties.taskType")] + public string TaskType { get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, + /// specify the weekly recurrence. + /// + [JsonProperty(PropertyName = "properties.weeklyRecurrence")] + public WeekDetails WeeklyRecurrence { get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, + /// specify the daily recurrence. + /// + [JsonProperty(PropertyName = "properties.dailyRecurrence")] + public DayDetails DailyRecurrence { get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, + /// specify the hourly recurrence. + /// + [JsonProperty(PropertyName = "properties.hourlyRecurrence")] + public HourDetails HourlyRecurrence { get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; set; } + + /// + /// Gets or sets notification settings. + /// + [JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettings NotificationSettings { get; set; } + + /// + /// Gets the creation date of the schedule. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [JsonProperty(PropertyName = "properties.targetResourceId")] + public string TargetResourceId { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameter.cs new file mode 100644 index 000000000000..d73b511d7111 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameter.cs @@ -0,0 +1,150 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties for creating a schedule. + /// + [Rest.Serialization.JsonTransformation] + public partial class ScheduleCreationParameter + { + /// + /// Initializes a new instance of the ScheduleCreationParameter class. + /// + public ScheduleCreationParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleCreationParameter class. + /// + /// The status of the schedule (i.e. Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// The task type of the schedule (e.g. + /// LabVmsShutdownTask, LabVmAutoStart). + /// If the schedule will occur only some + /// days of the week, specify the weekly recurrence. + /// If the schedule will occur once each + /// day of the week, specify the daily recurrence. + /// If the schedule will occur multiple + /// times a day, specify the hourly recurrence. + /// The time zone ID (e.g. Pacific Standard + /// time). + /// Notification settings. + /// The resource ID to which the + /// schedule belongs + /// The name of the virtual machine or + /// environment + /// The location of the new virtual machine or + /// environment + /// The tags of the resource. + public ScheduleCreationParameter(string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), NotificationSettings notificationSettings = default(NotificationSettings), string targetResourceId = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + { + Status = status; + TaskType = taskType; + WeeklyRecurrence = weeklyRecurrence; + DailyRecurrence = dailyRecurrence; + HourlyRecurrence = hourlyRecurrence; + TimeZoneId = timeZoneId; + NotificationSettings = notificationSettings; + TargetResourceId = targetResourceId; + Name = name; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. + /// LabVmsShutdownTask, LabVmAutoStart). + /// + [JsonProperty(PropertyName = "properties.taskType")] + public string TaskType { get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, + /// specify the weekly recurrence. + /// + [JsonProperty(PropertyName = "properties.weeklyRecurrence")] + public WeekDetails WeeklyRecurrence { get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, + /// specify the daily recurrence. + /// + [JsonProperty(PropertyName = "properties.dailyRecurrence")] + public DayDetails DailyRecurrence { get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, + /// specify the hourly recurrence. + /// + [JsonProperty(PropertyName = "properties.hourlyRecurrence")] + public HourDetails HourlyRecurrence { get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; set; } + + /// + /// Gets or sets notification settings. + /// + [JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettings NotificationSettings { get; set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [JsonProperty(PropertyName = "properties.targetResourceId")] + public string TargetResourceId { get; set; } + + /// + /// Gets or sets the name of the virtual machine or environment + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the location of the new virtual machine or environment + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the tags of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameterFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameterFragment.cs new file mode 100644 index 000000000000..1defb029e514 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameterFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties for creating a schedule. + /// + [Rest.Serialization.JsonTransformation] + public partial class ScheduleCreationParameterFragment + { + /// + /// Initializes a new instance of the ScheduleCreationParameterFragment + /// class. + /// + public ScheduleCreationParameterFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleCreationParameterFragment + /// class. + /// + /// The status of the schedule (i.e. Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// The task type of the schedule (e.g. + /// LabVmsShutdownTask, LabVmAutoStart). + /// If the schedule will occur only some + /// days of the week, specify the weekly recurrence. + /// If the schedule will occur once each + /// day of the week, specify the daily recurrence. + /// If the schedule will occur multiple + /// times a day, specify the hourly recurrence. + /// The time zone ID (e.g. Pacific Standard + /// time). + /// Notification settings. + /// The resource ID to which the + /// schedule belongs + /// The name of the virtual machine or + /// environment + /// The location of the new virtual machine or + /// environment + /// The tags of the resource. + public ScheduleCreationParameterFragment(string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + { + Status = status; + TaskType = taskType; + WeeklyRecurrence = weeklyRecurrence; + DailyRecurrence = dailyRecurrence; + HourlyRecurrence = hourlyRecurrence; + TimeZoneId = timeZoneId; + NotificationSettings = notificationSettings; + TargetResourceId = targetResourceId; + Name = name; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. + /// LabVmsShutdownTask, LabVmAutoStart). + /// + [JsonProperty(PropertyName = "properties.taskType")] + public string TaskType { get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, + /// specify the weekly recurrence. + /// + [JsonProperty(PropertyName = "properties.weeklyRecurrence")] + public WeekDetailsFragment WeeklyRecurrence { get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, + /// specify the daily recurrence. + /// + [JsonProperty(PropertyName = "properties.dailyRecurrence")] + public DayDetailsFragment DailyRecurrence { get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, + /// specify the hourly recurrence. + /// + [JsonProperty(PropertyName = "properties.hourlyRecurrence")] + public HourDetailsFragment HourlyRecurrence { get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; set; } + + /// + /// Gets or sets notification settings. + /// + [JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettingsFragment NotificationSettings { get; set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [JsonProperty(PropertyName = "properties.targetResourceId")] + public string TargetResourceId { get; set; } + + /// + /// Gets or sets the name of the virtual machine or environment + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the location of the new virtual machine or environment + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the tags of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs new file mode 100644 index 000000000000..4828a9706c46 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs @@ -0,0 +1,126 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A schedule. + /// + [Rest.Serialization.JsonTransformation] + public partial class ScheduleFragment : UpdateResource + { + /// + /// Initializes a new instance of the ScheduleFragment class. + /// + public ScheduleFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleFragment class. + /// + /// The tags of the resource. + /// The status of the schedule (i.e. Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// The task type of the schedule (e.g. + /// LabVmsShutdownTask, LabVmAutoStart). + /// If the schedule will occur only some + /// days of the week, specify the weekly recurrence. + /// If the schedule will occur once each + /// day of the week, specify the daily recurrence. + /// If the schedule will occur multiple + /// times a day, specify the hourly recurrence. + /// The time zone ID (e.g. Pacific Standard + /// time). + /// Notification settings. + /// The resource ID to which the + /// schedule belongs + public ScheduleFragment(IDictionary tags = default(IDictionary), string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string)) + : base(tags) + { + Status = status; + TaskType = taskType; + WeeklyRecurrence = weeklyRecurrence; + DailyRecurrence = dailyRecurrence; + HourlyRecurrence = hourlyRecurrence; + TimeZoneId = timeZoneId; + NotificationSettings = notificationSettings; + TargetResourceId = targetResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. + /// LabVmsShutdownTask, LabVmAutoStart). + /// + [JsonProperty(PropertyName = "properties.taskType")] + public string TaskType { get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, + /// specify the weekly recurrence. + /// + [JsonProperty(PropertyName = "properties.weeklyRecurrence")] + public WeekDetailsFragment WeeklyRecurrence { get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, + /// specify the daily recurrence. + /// + [JsonProperty(PropertyName = "properties.dailyRecurrence")] + public DayDetailsFragment DailyRecurrence { get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, + /// specify the hourly recurrence. + /// + [JsonProperty(PropertyName = "properties.hourlyRecurrence")] + public HourDetailsFragment HourlyRecurrence { get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; set; } + + /// + /// Gets or sets notification settings. + /// + [JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettingsFragment NotificationSettings { get; set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [JsonProperty(PropertyName = "properties.targetResourceId")] + public string TargetResourceId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs new file mode 100644 index 000000000000..8bd71cbbba36 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A secret. + /// + [Rest.Serialization.JsonTransformation] + public partial class Secret : Resource + { + /// + /// Initializes a new instance of the Secret class. + /// + public Secret() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Secret class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The value of the secret for secret + /// creation. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public Secret(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string value = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + Value = value; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value of the secret for secret creation. + /// + [JsonProperty(PropertyName = "properties.value")] + public string Value { get; set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretFragment.cs new file mode 100644 index 000000000000..05a5861fdcca --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A secret. + /// + [Rest.Serialization.JsonTransformation] + public partial class SecretFragment : UpdateResource + { + /// + /// Initializes a new instance of the SecretFragment class. + /// + public SecretFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretFragment class. + /// + /// The tags of the resource. + /// The value of the secret for secret + /// creation. + public SecretFragment(IDictionary tags = default(IDictionary), string value = default(string)) + : base(tags) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value of the secret for secret creation. + /// + [JsonProperty(PropertyName = "properties.value")] + public string Value { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabric.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabric.cs new file mode 100644 index 000000000000..dcde63d1e395 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabric.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Service Fabric. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServiceFabric : Resource + { + /// + /// Initializes a new instance of the ServiceFabric class. + /// + public ServiceFabric() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceFabric class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The backing service fabric + /// resource's id + /// The resource id of the environment + /// under which the service fabric resource is present + /// The applicable schedule for the + /// virtual machine. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public ServiceFabric(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string externalServiceFabricId = default(string), string environmentId = default(string), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + ExternalServiceFabricId = externalServiceFabricId; + EnvironmentId = environmentId; + ApplicableSchedule = applicableSchedule; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the backing service fabric resource's id + /// + [JsonProperty(PropertyName = "properties.externalServiceFabricId")] + public string ExternalServiceFabricId { get; set; } + + /// + /// Gets or sets the resource id of the environment under which the + /// service fabric resource is present + /// + [JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets the applicable schedule for the virtual machine. + /// + [JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableSchedule ApplicableSchedule { get; private set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabricFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabricFragment.cs new file mode 100644 index 000000000000..a652b7e4785a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabricFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Service Fabric. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServiceFabricFragment : UpdateResource + { + /// + /// Initializes a new instance of the ServiceFabricFragment class. + /// + public ServiceFabricFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceFabricFragment class. + /// + /// The tags of the resource. + /// The backing service fabric + /// resource's id + /// The resource id of the environment + /// under which the service fabric resource is present + public ServiceFabricFragment(IDictionary tags = default(IDictionary), string externalServiceFabricId = default(string), string environmentId = default(string)) + : base(tags) + { + ExternalServiceFabricId = externalServiceFabricId; + EnvironmentId = environmentId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the backing service fabric resource's id + /// + [JsonProperty(PropertyName = "properties.externalServiceFabricId")] + public string ExternalServiceFabricId { get; set; } + + /// + /// Gets or sets the resource id of the environment under which the + /// service fabric resource is present + /// + [JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs new file mode 100644 index 000000000000..b6bec3e30b71 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A container for a managed identity to execute DevTest lab services. + /// + public partial class ServiceRunner : Resource + { + /// + /// Initializes a new instance of the ServiceRunner class. + /// + public ServiceRunner() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceRunner class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The identity of the resource. + public ServiceRunner(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IdentityProperties identity = default(IdentityProperties)) + : base(id, name, type, location, tags) + { + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity of the resource. + /// + [JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs new file mode 100644 index 000000000000..710a96cbe20a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a virtual machine that determine how it is connected to a + /// load balancer. + /// + public partial class SharedPublicIpAddressConfiguration + { + /// + /// Initializes a new instance of the + /// SharedPublicIpAddressConfiguration class. + /// + public SharedPublicIpAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SharedPublicIpAddressConfiguration class. + /// + /// The incoming NAT rules + public SharedPublicIpAddressConfiguration(IList inboundNatRules = default(IList)) + { + InboundNatRules = inboundNatRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the incoming NAT rules + /// + [JsonProperty(PropertyName = "inboundNatRules")] + public IList InboundNatRules { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs new file mode 100644 index 000000000000..336c77faa8cd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a virtual machine that determine how it is connected to a + /// load balancer. + /// + public partial class SharedPublicIpAddressConfigurationFragment + { + /// + /// Initializes a new instance of the + /// SharedPublicIpAddressConfigurationFragment class. + /// + public SharedPublicIpAddressConfigurationFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SharedPublicIpAddressConfigurationFragment class. + /// + /// The incoming NAT rules + public SharedPublicIpAddressConfigurationFragment(IList inboundNatRules = default(IList)) + { + InboundNatRules = inboundNatRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the incoming NAT rules + /// + [JsonProperty(PropertyName = "inboundNatRules")] + public IList InboundNatRules { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs new file mode 100644 index 000000000000..4e70356a1587 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The contents of a shutdown notification. Webhooks can use this type to + /// deserialize the request body when they get notified of an imminent + /// shutdown. + /// + public partial class ShutdownNotificationContent + { + /// + /// Initializes a new instance of the ShutdownNotificationContent + /// class. + /// + public ShutdownNotificationContent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ShutdownNotificationContent + /// class. + /// + /// The URL to skip auto-shutdown. + /// The URL to delay shutdown by 60 + /// minutes. + /// The URL to delay shutdown by 2 + /// hours. + /// The virtual machine to be shut down. + /// The GUID for the virtual machine to be shut + /// down. + /// The owner of the virtual machine. + /// The URL of the virtual machine. + /// Minutes remaining until + /// shutdown + /// The event for which a notification will be + /// sent. + /// The text for the notification. + /// The subscription ID for the + /// schedule. + /// The resource group name for the + /// schedule. + /// The lab for the schedule. + public ShutdownNotificationContent(string skipUrl = default(string), string delayUrl60 = default(string), string delayUrl120 = default(string), string vmName = default(string), string guid = default(string), string owner = default(string), string vmUrl = default(string), string minutesUntilShutdown = default(string), string eventType = default(string), string text = default(string), string subscriptionId = default(string), string resourceGroupName = default(string), string labName = default(string)) + { + SkipUrl = skipUrl; + DelayUrl60 = delayUrl60; + DelayUrl120 = delayUrl120; + VmName = vmName; + Guid = guid; + Owner = owner; + VmUrl = vmUrl; + MinutesUntilShutdown = minutesUntilShutdown; + EventType = eventType; + Text = text; + SubscriptionId = subscriptionId; + ResourceGroupName = resourceGroupName; + LabName = labName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL to skip auto-shutdown. + /// + [JsonProperty(PropertyName = "skipUrl")] + public string SkipUrl { get; set; } + + /// + /// Gets or sets the URL to delay shutdown by 60 minutes. + /// + [JsonProperty(PropertyName = "delayUrl60")] + public string DelayUrl60 { get; set; } + + /// + /// Gets or sets the URL to delay shutdown by 2 hours. + /// + [JsonProperty(PropertyName = "delayUrl120")] + public string DelayUrl120 { get; set; } + + /// + /// Gets or sets the virtual machine to be shut down. + /// + [JsonProperty(PropertyName = "vmName")] + public string VmName { get; set; } + + /// + /// Gets or sets the GUID for the virtual machine to be shut down. + /// + [JsonProperty(PropertyName = "guid")] + public string Guid { get; set; } + + /// + /// Gets or sets the owner of the virtual machine. + /// + [JsonProperty(PropertyName = "owner")] + public string Owner { get; set; } + + /// + /// Gets or sets the URL of the virtual machine. + /// + [JsonProperty(PropertyName = "vmUrl")] + public string VmUrl { get; set; } + + /// + /// Gets or sets minutes remaining until shutdown + /// + [JsonProperty(PropertyName = "minutesUntilShutdown")] + public string MinutesUntilShutdown { get; set; } + + /// + /// Gets or sets the event for which a notification will be sent. + /// + [JsonProperty(PropertyName = "eventType")] + public string EventType { get; set; } + + /// + /// Gets or sets the text for the notification. + /// + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + /// + /// Gets or sets the subscription ID for the schedule. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the resource group name for the schedule. + /// + [JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName { get; set; } + + /// + /// Gets or sets the lab for the schedule. + /// + [JsonProperty(PropertyName = "labName")] + public string LabName { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs new file mode 100644 index 000000000000..971c18e93a54 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.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.DevTestLabs.Models +{ + + /// + /// Defines values for SourceControlType. + /// + public static class SourceControlType + { + public const string VsoGit = "VsoGit"; + public const string GitHub = "GitHub"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs new file mode 100644 index 000000000000..54e99c938c3e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.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.DevTestLabs.Models +{ + + /// + /// Defines values for StorageType. + /// + public static class StorageType + { + public const string Standard = "Standard"; + public const string Premium = "Premium"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs new file mode 100644 index 000000000000..ff6eae4914cd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Subnet information. + /// + public partial class Subnet + { + /// + /// Initializes a new instance of the Subnet class. + /// + public Subnet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Subnet class. + /// + /// The resource ID of the subnet. + /// The name of the subnet as seen in the + /// lab. + /// The permission policy of the subnet for + /// allowing public IP addresses (i.e. Allow, Deny)). Possible values + /// include: 'Default', 'Deny', 'Allow' + public Subnet(string resourceId = default(string), string labSubnetName = default(string), string allowPublicIp = default(string)) + { + ResourceId = resourceId; + LabSubnetName = labSubnetName; + AllowPublicIp = allowPublicIp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the subnet. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the name of the subnet as seen in the lab. + /// + [JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName { get; set; } + + /// + /// Gets or sets the permission policy of the subnet for allowing + /// public IP addresses (i.e. Allow, Deny)). Possible values include: + /// 'Default', 'Deny', 'Allow' + /// + [JsonProperty(PropertyName = "allowPublicIp")] + public string AllowPublicIp { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs new file mode 100644 index 000000000000..4d98ebc44731 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Subnet information. + /// + public partial class SubnetFragment + { + /// + /// Initializes a new instance of the SubnetFragment class. + /// + public SubnetFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubnetFragment class. + /// + /// The resource ID of the subnet. + /// The name of the subnet as seen in the + /// lab. + /// The permission policy of the subnet for + /// allowing public IP addresses (i.e. Allow, Deny)). Possible values + /// include: 'Default', 'Deny', 'Allow' + public SubnetFragment(string resourceId = default(string), string labSubnetName = default(string), string allowPublicIp = default(string)) + { + ResourceId = resourceId; + LabSubnetName = labSubnetName; + AllowPublicIp = allowPublicIp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the subnet. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the name of the subnet as seen in the lab. + /// + [JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName { get; set; } + + /// + /// Gets or sets the permission policy of the subnet for allowing + /// public IP addresses (i.e. Allow, Deny)). Possible values include: + /// 'Default', 'Deny', 'Allow' + /// + [JsonProperty(PropertyName = "allowPublicIp")] + public string AllowPublicIp { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs new file mode 100644 index 000000000000..8c3389b70183 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Property overrides on a subnet of a virtual network. + /// + public partial class SubnetOverride + { + /// + /// Initializes a new instance of the SubnetOverride class. + /// + public SubnetOverride() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubnetOverride class. + /// + /// The resource ID of the subnet. + /// The name given to the subnet within the + /// lab. + /// Indicates whether this + /// subnet can be used during virtual machine creation (i.e. Allow, + /// Deny). Possible values include: 'Default', 'Deny', 'Allow' + /// Indicates whether public + /// IP addresses can be assigned to virtual machines on this subnet + /// (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', + /// 'Allow' + /// Properties that + /// virtual machines on this subnet will share. + /// The virtual network pool + /// associated with this subnet. + public SubnetOverride(string resourceId = default(string), string labSubnetName = default(string), string useInVmCreationPermission = default(string), string usePublicIpAddressPermission = default(string), SubnetSharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration = default(SubnetSharedPublicIpAddressConfiguration), string virtualNetworkPoolName = default(string)) + { + ResourceId = resourceId; + LabSubnetName = labSubnetName; + UseInVmCreationPermission = useInVmCreationPermission; + UsePublicIpAddressPermission = usePublicIpAddressPermission; + SharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + VirtualNetworkPoolName = virtualNetworkPoolName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the subnet. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the name given to the subnet within the lab. + /// + [JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName { get; set; } + + /// + /// Gets or sets indicates whether this subnet can be used during + /// virtual machine creation (i.e. Allow, Deny). Possible values + /// include: 'Default', 'Deny', 'Allow' + /// + [JsonProperty(PropertyName = "useInVmCreationPermission")] + public string UseInVmCreationPermission { get; set; } + + /// + /// Gets or sets indicates whether public IP addresses can be assigned + /// to virtual machines on this subnet (i.e. Allow, Deny). Possible + /// values include: 'Default', 'Deny', 'Allow' + /// + [JsonProperty(PropertyName = "usePublicIpAddressPermission")] + public string UsePublicIpAddressPermission { get; set; } + + /// + /// Gets or sets properties that virtual machines on this subnet will + /// share. + /// + [JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SubnetSharedPublicIpAddressConfiguration SharedPublicIpAddressConfiguration { get; set; } + + /// + /// Gets or sets the virtual network pool associated with this subnet. + /// + [JsonProperty(PropertyName = "virtualNetworkPoolName")] + public string VirtualNetworkPoolName { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs new file mode 100644 index 000000000000..4aa35009a12b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Property overrides on a subnet of a virtual network. + /// + public partial class SubnetOverrideFragment + { + /// + /// Initializes a new instance of the SubnetOverrideFragment class. + /// + public SubnetOverrideFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubnetOverrideFragment class. + /// + /// The resource ID of the subnet. + /// The name given to the subnet within the + /// lab. + /// Indicates whether this + /// subnet can be used during virtual machine creation (i.e. Allow, + /// Deny). Possible values include: 'Default', 'Deny', 'Allow' + /// Indicates whether public + /// IP addresses can be assigned to virtual machines on this subnet + /// (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', + /// 'Allow' + /// Properties that + /// virtual machines on this subnet will share. + /// The virtual network pool + /// associated with this subnet. + public SubnetOverrideFragment(string resourceId = default(string), string labSubnetName = default(string), string useInVmCreationPermission = default(string), string usePublicIpAddressPermission = default(string), SubnetSharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration = default(SubnetSharedPublicIpAddressConfigurationFragment), string virtualNetworkPoolName = default(string)) + { + ResourceId = resourceId; + LabSubnetName = labSubnetName; + UseInVmCreationPermission = useInVmCreationPermission; + UsePublicIpAddressPermission = usePublicIpAddressPermission; + SharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + VirtualNetworkPoolName = virtualNetworkPoolName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the subnet. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the name given to the subnet within the lab. + /// + [JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName { get; set; } + + /// + /// Gets or sets indicates whether this subnet can be used during + /// virtual machine creation (i.e. Allow, Deny). Possible values + /// include: 'Default', 'Deny', 'Allow' + /// + [JsonProperty(PropertyName = "useInVmCreationPermission")] + public string UseInVmCreationPermission { get; set; } + + /// + /// Gets or sets indicates whether public IP addresses can be assigned + /// to virtual machines on this subnet (i.e. Allow, Deny). Possible + /// values include: 'Default', 'Deny', 'Allow' + /// + [JsonProperty(PropertyName = "usePublicIpAddressPermission")] + public string UsePublicIpAddressPermission { get; set; } + + /// + /// Gets or sets properties that virtual machines on this subnet will + /// share. + /// + [JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SubnetSharedPublicIpAddressConfigurationFragment SharedPublicIpAddressConfiguration { get; set; } + + /// + /// Gets or sets the virtual network pool associated with this subnet. + /// + [JsonProperty(PropertyName = "virtualNetworkPoolName")] + public string VirtualNetworkPoolName { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs new file mode 100644 index 000000000000..611403e7b2e5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Configuration for public IP address sharing. + /// + public partial class SubnetSharedPublicIpAddressConfiguration + { + /// + /// Initializes a new instance of the + /// SubnetSharedPublicIpAddressConfiguration class. + /// + public SubnetSharedPublicIpAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SubnetSharedPublicIpAddressConfiguration class. + /// + /// Backend ports that virtual machines on + /// this subnet are allowed to expose + public SubnetSharedPublicIpAddressConfiguration(IList allowedPorts = default(IList)) + { + AllowedPorts = allowedPorts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets backend ports that virtual machines on this subnet are + /// allowed to expose + /// + [JsonProperty(PropertyName = "allowedPorts")] + public IList AllowedPorts { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs new file mode 100644 index 000000000000..561d700b10e7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Configuration for public IP address sharing. + /// + public partial class SubnetSharedPublicIpAddressConfigurationFragment + { + /// + /// Initializes a new instance of the + /// SubnetSharedPublicIpAddressConfigurationFragment class. + /// + public SubnetSharedPublicIpAddressConfigurationFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SubnetSharedPublicIpAddressConfigurationFragment class. + /// + /// Backend ports that virtual machines on + /// this subnet are allowed to expose + public SubnetSharedPublicIpAddressConfigurationFragment(IList allowedPorts = default(IList)) + { + AllowedPorts = allowedPorts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets backend ports that virtual machines on this subnet are + /// allowed to expose + /// + [JsonProperty(PropertyName = "allowedPorts")] + public IList AllowedPorts { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs new file mode 100644 index 000000000000..b873e4154670 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a cost target. + /// + public partial class TargetCostProperties + { + /// + /// Initializes a new instance of the TargetCostProperties class. + /// + public TargetCostProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetCostProperties class. + /// + /// Target cost status. Possible values include: + /// 'Enabled', 'Disabled' + /// Lab target cost + /// Cost thresholds. + /// Reporting cycle start + /// date. + /// Reporting cycle end date. + /// Reporting cycle type. Possible values + /// include: 'CalendarMonth', 'Custom' + public TargetCostProperties(string status = default(string), int? target = default(int?), IList costThresholds = default(IList), System.DateTime? cycleStartDateTime = default(System.DateTime?), System.DateTime? cycleEndDateTime = default(System.DateTime?), string cycleType = default(string)) + { + Status = status; + Target = target; + CostThresholds = costThresholds; + CycleStartDateTime = cycleStartDateTime; + CycleEndDateTime = cycleEndDateTime; + CycleType = cycleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets target cost status. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets lab target cost + /// + [JsonProperty(PropertyName = "target")] + public int? Target { get; set; } + + /// + /// Gets or sets cost thresholds. + /// + [JsonProperty(PropertyName = "costThresholds")] + public IList CostThresholds { get; set; } + + /// + /// Gets or sets reporting cycle start date. + /// + [JsonProperty(PropertyName = "cycleStartDateTime")] + public System.DateTime? CycleStartDateTime { get; set; } + + /// + /// Gets or sets reporting cycle end date. + /// + [JsonProperty(PropertyName = "cycleEndDateTime")] + public System.DateTime? CycleEndDateTime { get; set; } + + /// + /// Gets or sets reporting cycle type. Possible values include: + /// 'CalendarMonth', 'Custom' + /// + [JsonProperty(PropertyName = "cycleType")] + public string CycleType { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs new file mode 100644 index 000000000000..09e9960f369b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.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.DevTestLabs.Models +{ + + /// + /// Defines values for TargetCostStatus. + /// + public static class TargetCostStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs new file mode 100644 index 000000000000..6c16537b3406 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.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.DevTestLabs.Models +{ + + /// + /// Defines values for TransportProtocol. + /// + public static class TransportProtocol + { + public const string Tcp = "Tcp"; + public const string Udp = "Udp"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UpdateResource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UpdateResource.cs new file mode 100644 index 000000000000..b37614587664 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an update resource + /// + public partial class UpdateResource + { + /// + /// Initializes a new instance of the UpdateResource class. + /// + public UpdateResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateResource class. + /// + /// The tags of the resource. + 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 the tags of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs new file mode 100644 index 000000000000..d5715cf73a8c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.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.DevTestLabs.Models +{ + + /// + /// Defines values for UsagePermissionType. + /// + public static class UsagePermissionType + { + public const string Default = "Default"; + public const string Deny = "Deny"; + public const string Allow = "Allow"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs new file mode 100644 index 000000000000..8d3523eaa857 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Profile of a lab user. + /// + [Rest.Serialization.JsonTransformation] + public partial class User : Resource + { + /// + /// Initializes a new instance of the User class. + /// + public User() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the User class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The identity of the user. + /// The secret store of the user. + /// The creation date of the user + /// profile. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public User(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), UserIdentity identity = default(UserIdentity), UserSecretStore secretStore = default(UserSecretStore), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + Identity = identity; + SecretStore = secretStore; + CreatedDate = createdDate; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity of the user. + /// + [JsonProperty(PropertyName = "properties.identity")] + public UserIdentity Identity { get; set; } + + /// + /// Gets or sets the secret store of the user. + /// + [JsonProperty(PropertyName = "properties.secretStore")] + public UserSecretStore SecretStore { get; set; } + + /// + /// Gets the creation date of the user profile. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs new file mode 100644 index 000000000000..9882a2c4c9c4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Profile of a lab user. + /// + [Rest.Serialization.JsonTransformation] + public partial class UserFragment : UpdateResource + { + /// + /// Initializes a new instance of the UserFragment class. + /// + public UserFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserFragment class. + /// + /// The tags of the resource. + /// The identity of the user. + /// The secret store of the user. + public UserFragment(IDictionary tags = default(IDictionary), UserIdentityFragment identity = default(UserIdentityFragment), UserSecretStoreFragment secretStore = default(UserSecretStoreFragment)) + : base(tags) + { + Identity = identity; + SecretStore = secretStore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity of the user. + /// + [JsonProperty(PropertyName = "properties.identity")] + public UserIdentityFragment Identity { get; set; } + + /// + /// Gets or sets the secret store of the user. + /// + [JsonProperty(PropertyName = "properties.secretStore")] + public UserSecretStoreFragment SecretStore { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs new file mode 100644 index 000000000000..4300315e3bd8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Identity attributes of a lab user. + /// + public partial class UserIdentity + { + /// + /// Initializes a new instance of the UserIdentity class. + /// + public UserIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentity class. + /// + /// Set to the principal name / UPN of the + /// client JWT making the request. + /// Set to the principal Id of the client JWT + /// making the request. Service principal will not have the principal + /// Id. + /// Set to the tenant ID of the client JWT + /// making the request. + /// Set to the object Id of the client JWT + /// making the request. Not all users have object Id. For CSP + /// (reseller) scenarios for example, object Id is not + /// available. + /// Set to the app Id of the client JWT making the + /// request. + public UserIdentity(string principalName = default(string), string principalId = default(string), string tenantId = default(string), string objectId = default(string), string appId = default(string)) + { + PrincipalName = principalName; + PrincipalId = principalId; + TenantId = tenantId; + ObjectId = objectId; + AppId = appId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets set to the principal name / UPN of the client JWT + /// making the request. + /// + [JsonProperty(PropertyName = "principalName")] + public string PrincipalName { get; set; } + + /// + /// Gets or sets set to the principal Id of the client JWT making the + /// request. Service principal will not have the principal Id. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets set to the tenant ID of the client JWT making the + /// request. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets set to the object Id of the client JWT making the + /// request. Not all users have object Id. For CSP (reseller) scenarios + /// for example, object Id is not available. + /// + [JsonProperty(PropertyName = "objectId")] + public string ObjectId { get; set; } + + /// + /// Gets or sets set to the app Id of the client JWT making the + /// request. + /// + [JsonProperty(PropertyName = "appId")] + public string AppId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs new file mode 100644 index 000000000000..da124b736c0c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Identity attributes of a lab user. + /// + public partial class UserIdentityFragment + { + /// + /// Initializes a new instance of the UserIdentityFragment class. + /// + public UserIdentityFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentityFragment class. + /// + /// Set to the principal name / UPN of the + /// client JWT making the request. + /// Set to the principal Id of the client JWT + /// making the request. Service principal will not have the principal + /// Id. + /// Set to the tenant ID of the client JWT + /// making the request. + /// Set to the object Id of the client JWT + /// making the request. Not all users have object Id. For CSP + /// (reseller) scenarios for example, object Id is not + /// available. + /// Set to the app Id of the client JWT making the + /// request. + public UserIdentityFragment(string principalName = default(string), string principalId = default(string), string tenantId = default(string), string objectId = default(string), string appId = default(string)) + { + PrincipalName = principalName; + PrincipalId = principalId; + TenantId = tenantId; + ObjectId = objectId; + AppId = appId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets set to the principal name / UPN of the client JWT + /// making the request. + /// + [JsonProperty(PropertyName = "principalName")] + public string PrincipalName { get; set; } + + /// + /// Gets or sets set to the principal Id of the client JWT making the + /// request. Service principal will not have the principal Id. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets set to the tenant ID of the client JWT making the + /// request. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets set to the object Id of the client JWT making the + /// request. Not all users have object Id. For CSP (reseller) scenarios + /// for example, object Id is not available. + /// + [JsonProperty(PropertyName = "objectId")] + public string ObjectId { get; set; } + + /// + /// Gets or sets set to the app Id of the client JWT making the + /// request. + /// + [JsonProperty(PropertyName = "appId")] + public string AppId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs new file mode 100644 index 000000000000..009e9f5bc1c7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a user's secret store. + /// + public partial class UserSecretStore + { + /// + /// Initializes a new instance of the UserSecretStore class. + /// + public UserSecretStore() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserSecretStore class. + /// + /// The URI of the user's Key vault. + /// The ID of the user's Key vault. + public UserSecretStore(string keyVaultUri = default(string), string keyVaultId = default(string)) + { + KeyVaultUri = keyVaultUri; + KeyVaultId = keyVaultId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI of the user's Key vault. + /// + [JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri { get; set; } + + /// + /// Gets or sets the ID of the user's Key vault. + /// + [JsonProperty(PropertyName = "keyVaultId")] + public string KeyVaultId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs new file mode 100644 index 000000000000..b0c2bf8da693 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a user's secret store. + /// + public partial class UserSecretStoreFragment + { + /// + /// Initializes a new instance of the UserSecretStoreFragment class. + /// + public UserSecretStoreFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserSecretStoreFragment class. + /// + /// The URI of the user's Key vault. + /// The ID of the user's Key vault. + public UserSecretStoreFragment(string keyVaultUri = default(string), string keyVaultId = default(string)) + { + KeyVaultUri = keyVaultUri; + KeyVaultId = keyVaultId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI of the user's Key vault. + /// + [JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri { get; set; } + + /// + /// Gets or sets the ID of the user's Key vault. + /// + [JsonProperty(PropertyName = "keyVaultId")] + public string KeyVaultId { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs new file mode 100644 index 000000000000..4899e4d31fb4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.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.DevTestLabs.Models +{ + + /// + /// Defines values for VirtualMachineCreationSource. + /// + public static class VirtualMachineCreationSource + { + public const string FromCustomImage = "FromCustomImage"; + public const string FromGalleryImage = "FromGalleryImage"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs new file mode 100644 index 000000000000..59fe1a1ae8e7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A virtual network. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualNetwork : Resource + { + /// + /// Initializes a new instance of the VirtualNetwork class. + /// + public VirtualNetwork() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetwork class. + /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. + /// The tags of the resource. + /// The allowed subnets of the virtual + /// network. + /// The description of the virtual + /// network. + /// The Microsoft.Network + /// resource identifier of the virtual network. + /// The external subnet + /// properties. + /// The subnet overrides of the virtual + /// network. + /// The creation date of the virtual + /// network. + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public VirtualNetwork(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList allowedSubnets = default(IList), string description = default(string), string externalProviderResourceId = default(string), IList externalSubnets = default(IList), IList subnetOverrides = default(IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) + { + AllowedSubnets = allowedSubnets; + Description = description; + ExternalProviderResourceId = externalProviderResourceId; + ExternalSubnets = externalSubnets; + SubnetOverrides = subnetOverrides; + CreatedDate = createdDate; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the allowed subnets of the virtual network. + /// + [JsonProperty(PropertyName = "properties.allowedSubnets")] + public IList AllowedSubnets { get; set; } + + /// + /// Gets or sets the description of the virtual network. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Microsoft.Network resource identifier of the + /// virtual network. + /// + [JsonProperty(PropertyName = "properties.externalProviderResourceId")] + public string ExternalProviderResourceId { get; set; } + + /// + /// Gets the external subnet properties. + /// + [JsonProperty(PropertyName = "properties.externalSubnets")] + public IList ExternalSubnets { get; private set; } + + /// + /// Gets or sets the subnet overrides of the virtual network. + /// + [JsonProperty(PropertyName = "properties.subnetOverrides")] + public IList SubnetOverrides { get; set; } + + /// + /// Gets the creation date of the virtual network. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; private set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs new file mode 100644 index 000000000000..57dfabe0840f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.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.DevTestLabs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A virtual network. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualNetworkFragment : UpdateResource + { + /// + /// Initializes a new instance of the VirtualNetworkFragment class. + /// + public VirtualNetworkFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkFragment class. + /// + /// The tags of the resource. + /// The allowed subnets of the virtual + /// network. + /// The description of the virtual + /// network. + /// The Microsoft.Network + /// resource identifier of the virtual network. + /// The subnet overrides of the virtual + /// network. + public VirtualNetworkFragment(IDictionary tags = default(IDictionary), IList allowedSubnets = default(IList), string description = default(string), string externalProviderResourceId = default(string), IList subnetOverrides = default(IList)) + : base(tags) + { + AllowedSubnets = allowedSubnets; + Description = description; + ExternalProviderResourceId = externalProviderResourceId; + SubnetOverrides = subnetOverrides; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the allowed subnets of the virtual network. + /// + [JsonProperty(PropertyName = "properties.allowedSubnets")] + public IList AllowedSubnets { get; set; } + + /// + /// Gets or sets the description of the virtual network. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Microsoft.Network resource identifier of the + /// virtual network. + /// + [JsonProperty(PropertyName = "properties.externalProviderResourceId")] + public string ExternalProviderResourceId { get; set; } + + /// + /// Gets or sets the subnet overrides of the virtual network. + /// + [JsonProperty(PropertyName = "properties.subnetOverrides")] + public IList SubnetOverrides { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs new file mode 100644 index 000000000000..528ecce78b17 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a weekly schedule. + /// + public partial class WeekDetails + { + /// + /// Initializes a new instance of the WeekDetails class. + /// + public WeekDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WeekDetails class. + /// + /// The days of the week for which the schedule + /// is set (e.g. Sunday, Monday, Tuesday, etc.). + /// The time of the day the schedule will + /// occur. + public WeekDetails(IList weekdays = default(IList), string time = default(string)) + { + Weekdays = weekdays; + Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the days of the week for which the schedule is set + /// (e.g. Sunday, Monday, Tuesday, etc.). + /// + [JsonProperty(PropertyName = "weekdays")] + public IList Weekdays { get; set; } + + /// + /// Gets or sets the time of the day the schedule will occur. + /// + [JsonProperty(PropertyName = "time")] + public string Time { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs new file mode 100644 index 000000000000..ccc4a5195f54 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a weekly schedule. + /// + public partial class WeekDetailsFragment + { + /// + /// Initializes a new instance of the WeekDetailsFragment class. + /// + public WeekDetailsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WeekDetailsFragment class. + /// + /// The days of the week for which the schedule + /// is set (e.g. Sunday, Monday, Tuesday, etc.). + /// The time of the day the schedule will + /// occur. + public WeekDetailsFragment(IList weekdays = default(IList), string time = default(string)) + { + Weekdays = weekdays; + Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the days of the week for which the schedule is set + /// (e.g. Sunday, Monday, Tuesday, etc.). + /// + [JsonProperty(PropertyName = "weekdays")] + public IList Weekdays { get; set; } + + /// + /// Gets or sets the time of the day the schedule will occur. + /// + [JsonProperty(PropertyName = "time")] + public string Time { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs new file mode 100644 index 000000000000..ecd2c48d18eb --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a Windows OS. + /// + public partial class WindowsOsInfo + { + /// + /// Initializes a new instance of the WindowsOsInfo class. + /// + public WindowsOsInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsOsInfo class. + /// + /// The state of the Windows OS (i.e. + /// NonSysprepped, SysprepRequested, SysprepApplied). Possible values + /// include: 'NonSysprepped', 'SysprepRequested', + /// 'SysprepApplied' + public WindowsOsInfo(string windowsOsState = default(string)) + { + WindowsOsState = windowsOsState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of the Windows OS (i.e. NonSysprepped, + /// SysprepRequested, SysprepApplied). Possible values include: + /// 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' + /// + [JsonProperty(PropertyName = "windowsOsState")] + public string WindowsOsState { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfoFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfoFragment.cs new file mode 100644 index 000000000000..90e4e3199297 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfoFragment.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.DevTestLabs.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a Windows OS. + /// + public partial class WindowsOsInfoFragment + { + /// + /// Initializes a new instance of the WindowsOsInfoFragment class. + /// + public WindowsOsInfoFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsOsInfoFragment class. + /// + /// The state of the Windows OS (i.e. + /// NonSysprepped, SysprepRequested, SysprepApplied). Possible values + /// include: 'NonSysprepped', 'SysprepRequested', + /// 'SysprepApplied' + public WindowsOsInfoFragment(string windowsOsState = default(string)) + { + WindowsOsState = windowsOsState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of the Windows OS (i.e. NonSysprepped, + /// SysprepRequested, SysprepApplied). Possible values include: + /// 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' + /// + [JsonProperty(PropertyName = "windowsOsState")] + public string WindowsOsState { get; set; } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs new file mode 100644 index 000000000000..c97401fc9db1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.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.DevTestLabs.Models +{ + + /// + /// Defines values for WindowsOsState. + /// + public static class WindowsOsState + { + public const string NonSysprepped = "NonSysprepped"; + public const string SysprepRequested = "SysprepRequested"; + public const string SysprepApplied = "SysprepApplied"; + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs new file mode 100644 index 000000000000..6ae26e6c6117 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs @@ -0,0 +1,1487 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// NotificationChannelsOperations operations. + /// + internal partial class NotificationChannelsOperations : IServiceOperations, INotificationChannelsOperations + { + /// + /// Initializes a new instance of the NotificationChannelsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal NotificationChannelsOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List notificationchannels in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/notificationchannels").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 notificationchannel. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing notificationChannel. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, NotificationChannel notificationChannel, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (notificationChannel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "notificationChannel"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("notificationChannel", notificationChannel); + 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.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(notificationChannel != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(notificationChannel, 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); + } + System.Net.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; + } + + /// + /// Delete notificationchannel. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of notificationchannels. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, NotificationChannelFragment notificationChannel, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (notificationChannel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "notificationChannel"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("notificationChannel", notificationChannel); + 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.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(notificationChannel != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(notificationChannel, 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); + } + System.Net.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; + } + + /// + /// Send notification to provided channel. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Properties for generating a Notification. + /// + /// + /// 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 NotifyWithHttpMessagesAsync(string resourceGroupName, string labName, string name, NotifyParameters notifyParameters, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (notifyParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "notifyParameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("notifyParameters", notifyParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Notify", 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.DevTestLab/labs/{labName}/notificationchannels/{name}/notify").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(notifyParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(notifyParameters, 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); + } + System.Net.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; + } + + /// + /// List notificationchannels in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs new file mode 100644 index 000000000000..064d2cd4251e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs @@ -0,0 +1,354 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for NotificationChannelsOperations. + /// + public static partial class NotificationChannelsOperationsExtensions + { + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this INotificationChannelsOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + public static NotificationChannel Get(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + public static NotificationChannel CreateOrUpdate(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotificationChannel notificationChannel) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, notificationChannel).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotificationChannel notificationChannel, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static void Delete(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of notificationchannels. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + public static NotificationChannel Update(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotificationChannelFragment notificationChannel) + { + return operations.UpdateAsync(resourceGroupName, labName, name, notificationChannel).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of notificationchannels. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotificationChannelFragment notificationChannel, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Send notification to provided channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Properties for generating a Notification. + /// + public static void Notify(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotifyParameters notifyParameters) + { + operations.NotifyAsync(resourceGroupName, labName, name, notifyParameters).GetAwaiter().GetResult(); + } + + /// + /// Send notification to provided channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Properties for generating a Notification. + /// + /// + /// The cancellation token. + /// + public static async Task NotifyAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotifyParameters notifyParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.NotifyWithHttpMessagesAsync(resourceGroupName, labName, name, notifyParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this INotificationChannelsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List notificationchannels in a given lab. + /// + /// + /// 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 INotificationChannelsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs new file mode 100644 index 000000000000..3b0bae030203 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs @@ -0,0 +1,250 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// Get operation. + /// + /// + /// The name of the location. + /// + /// + /// The name of 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 locationName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("name", name); + 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.DevTestLab/locations/{locationName}/operations/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..31bbdc304eb2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Get operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The name of the operation. + /// + public static OperationResult Get(this IOperations operations, string locationName, string name) + { + return operations.GetAsync(locationName, name).GetAwaiter().GetResult(); + } + + /// + /// Get operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The name of the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOperations operations, string locationName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs new file mode 100644 index 000000000000..74fafef9a6ed --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs @@ -0,0 +1,1334 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// PoliciesOperations operations. + /// + internal partial class PoliciesOperations : IServiceOperations, IPoliciesOperations + { + /// + /// Initializes a new instance of the PoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PoliciesOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List policies in a given policy set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (policySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("policySetName", policySetName); + 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.DevTestLab/labs/{labName}/policysets/{policySetName}/policies").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string policySetName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (policySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string policySetName, string name, Policy policy, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (policySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (policy == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policy"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + tracingParameters.Add("name", name); + tracingParameters.Add("policy", policy); + 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.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(policy != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(policy, 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); + } + System.Net.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; + } + + /// + /// Delete policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// 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 labName, string policySetName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (policySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of policies. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string policySetName, string name, PolicyFragment policy, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (policySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (policy == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policy"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + tracingParameters.Add("name", name); + tracingParameters.Add("policy", policy); + 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.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(policy != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(policy, 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); + } + System.Net.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 policies in a given policy 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs new file mode 100644 index 000000000000..6723927d73ae --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs @@ -0,0 +1,335 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PoliciesOperations. + /// + public static partial class PoliciesOperationsExtensions + { + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, policySetName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, policySetName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + public static Policy Get(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, policySetName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, policySetName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + public static Policy CreateOrUpdate(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, Policy policy) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, policySetName, name, policy).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, Policy policy, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + public static void Delete(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, policySetName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, policySetName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + public static Policy Update(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, PolicyFragment policy) + { + return operations.UpdateAsync(resourceGroupName, labName, policySetName, name, policy).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, PolicyFragment policy, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPoliciesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List policies in a given policy 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 IPoliciesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs new file mode 100644 index 000000000000..49dfadb1381d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.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.DevTestLabs +{ + 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; + + /// + /// PolicySetsOperations operations. + /// + internal partial class PolicySetsOperations : IServiceOperations, IPolicySetsOperations + { + /// + /// Initializes a new instance of the PolicySetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PolicySetsOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// Evaluates lab policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// Request body for evaluating a policy 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> EvaluatePoliciesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (evaluatePoliciesRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "evaluatePoliciesRequest"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("evaluatePoliciesRequest", evaluatePoliciesRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "EvaluatePolicies", 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.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(evaluatePoliciesRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(evaluatePoliciesRequest, 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs new file mode 100644 index 000000000000..1139c6158a57 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PolicySetsOperations. + /// + public static partial class PolicySetsOperationsExtensions + { + /// + /// Evaluates lab policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// Request body for evaluating a policy set. + /// + public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetsOperations operations, string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest) + { + return operations.EvaluatePoliciesAsync(resourceGroupName, labName, name, evaluatePoliciesRequest).GetAwaiter().GetResult(); + } + + /// + /// Evaluates lab policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// Request body for evaluating a policy set. + /// + /// + /// The cancellation token. + /// + public static async Task EvaluatePoliciesAsync(this IPolicySetsOperations operations, string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.EvaluatePoliciesWithHttpMessagesAsync(resourceGroupName, labName, name, evaluatePoliciesRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs new file mode 100644 index 000000000000..c176c9e44add --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs @@ -0,0 +1,400 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// ProviderOperations operations. + /// + internal partial class ProviderOperations : IServiceOperations, IProviderOperations + { + /// + /// Initializes a new instance of the ProviderOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProviderOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// Result of the request to list REST API 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 + /// + /// + /// Thrown when a 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.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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.DevTestLab/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Result of the request to list REST API operations + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs new file mode 100644 index 000000000000..28ef5bf7374d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProviderOperations. + /// + public static partial class ProviderOperationsExtensions + { + /// + /// Result of the request to list REST API operations + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IProviderOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Result of the request to list REST API operations + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IProviderOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Result of the request to list REST API operations + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IProviderOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Result of the request to list REST API operations + /// + /// + /// 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 IProviderOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs new file mode 100644 index 000000000000..255af83eae5a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs @@ -0,0 +1,1876 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// SchedulesOperations operations. + /// + internal partial class SchedulesOperations : IServiceOperations, ISchedulesOperations + { + /// + /// Initializes a new instance of the SchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SchedulesOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List schedules in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/schedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, Schedule schedule, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + 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.DevTestLab/labs/{labName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(schedule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); + } + System.Net.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; + } + + /// + /// Delete schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of schedules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, ScheduleFragment schedule, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + 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.DevTestLab/labs/{labName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(schedule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); + } + System.Net.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; + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListApplicableWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListApplicable", 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.DevTestLab/labs/{labName}/schedules/{name}/listApplicable").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", 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.DevTestLab/labs/{labName}/schedules/{name}/execute").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// List schedules in a given lab. + /// + /// + /// 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); + } + System.Net.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 applicable schedules + /// + /// + /// 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>> ListApplicableNextWithHttpMessagesAsync(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, "ListApplicableNext", 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("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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..6e9842798bf7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SchedulesOperations. + /// + public static partial class SchedulesOperationsExtensions + { + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this ISchedulesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + public static Schedule CreateOrUpdate(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, Schedule schedule) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this ISchedulesOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + public static Schedule Update(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, ScheduleFragment schedule) + { + return operations.UpdateAsync(resourceGroupName, labName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this ISchedulesOperations operations, string resourceGroupName, string labName, string name) + { + operations.ExecuteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static IPage ListApplicable(this ISchedulesOperations operations, string resourceGroupName, string labName, string name) + { + return operations.ListApplicableAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task> ListApplicableAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListApplicableWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this ISchedulesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginExecuteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExecuteAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISchedulesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given lab. + /// + /// + /// 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 ISchedulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListApplicableNext(this ISchedulesOperations operations, string nextPageLink) + { + return operations.ListApplicableNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListApplicableNextAsync(this ISchedulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListApplicableNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs new file mode 100644 index 000000000000..2aafa74d6b54 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs @@ -0,0 +1,51 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_DevTestLabsClient + { + get + { + return new Tuple[] + { + new Tuple("DevTestLab", "ArmTemplates", "2018-09-15"), + new Tuple("DevTestLab", "ArtifactSources", "2018-09-15"), + new Tuple("DevTestLab", "Artifacts", "2018-09-15"), + new Tuple("DevTestLab", "Costs", "2018-09-15"), + new Tuple("DevTestLab", "CustomImages", "2018-09-15"), + new Tuple("DevTestLab", "Disks", "2018-09-15"), + new Tuple("DevTestLab", "Environments", "2018-09-15"), + new Tuple("DevTestLab", "Formulas", "2018-09-15"), + new Tuple("DevTestLab", "GalleryImages", "2018-09-15"), + new Tuple("DevTestLab", "GlobalSchedules", "2018-09-15"), + new Tuple("DevTestLab", "Labs", "2018-09-15"), + new Tuple("DevTestLab", "NotificationChannels", "2018-09-15"), + new Tuple("DevTestLab", "Operations", "2018-09-15"), + new Tuple("DevTestLab", "Policies", "2018-09-15"), + new Tuple("DevTestLab", "PolicySets", "2018-09-15"), + new Tuple("DevTestLab", "ProviderOperations", "2018-09-15"), + new Tuple("DevTestLab", "Schedules", "2018-09-15"), + new Tuple("DevTestLab", "Secrets", "2018-09-15"), + new Tuple("DevTestLab", "ServiceFabricSchedules", "2018-09-15"), + new Tuple("DevTestLab", "ServiceFabrics", "2018-09-15"), + new Tuple("DevTestLab", "ServiceRunners", "2018-09-15"), + new Tuple("DevTestLab", "Users", "2018-09-15"), + new Tuple("DevTestLab", "VirtualMachineSchedules", "2018-09-15"), + new Tuple("DevTestLab", "VirtualMachines", "2018-09-15"), + new Tuple("DevTestLab", "VirtualNetworks", "2018-09-15"), + }.AsEnumerable(); + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs new file mode 100644 index 000000000000..320ddbd030af --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs @@ -0,0 +1,1367 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// SecretsOperations operations. + /// + internal partial class SecretsOperations : IServiceOperations, ISecretsOperations + { + /// + /// Initializes a new instance of the SecretsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SecretsOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List secrets in a given user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("userName", userName); + 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.DevTestLab/labs/{labName}/users/{userName}/secrets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 secret. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing secret. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, secret, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete secret. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of secrets. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, SecretFragment secret, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (secret == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secret"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("secret", secret); + 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.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(secret != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(secret, 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); + } + System.Net.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 replace an existing secret. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, Secret secret, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (secret == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secret"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("secret", secret); + 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.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(secret != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(secret, 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); + } + System.Net.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; + } + + /// + /// List secrets in a given user profile. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs new file mode 100644 index 000000000000..ec8527f3eabe --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs @@ -0,0 +1,397 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SecretsOperations. + /// + public static partial class SecretsOperationsExtensions + { + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, userName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + public static Secret Get(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, userName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing secret. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + public static Secret CreateOrUpdate(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, Secret secret) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, name, secret).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing secret. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, Secret secret, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + public static void Delete(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + public static Secret Update(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, SecretFragment secret) + { + return operations.UpdateAsync(resourceGroupName, labName, userName, name, secret).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, SecretFragment secret, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing secret. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + public static Secret BeginCreateOrUpdate(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, Secret secret) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, userName, name, secret).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing secret. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, Secret secret, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISecretsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List secrets in a given user profile. + /// + /// + /// 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 ISecretsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperations.cs new file mode 100644 index 000000000000..8521bda504ea --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperations.cs @@ -0,0 +1,1612 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// ServiceFabricSchedulesOperations operations. + /// + internal partial class ServiceFabricSchedulesOperations : IServiceOperations, IServiceFabricSchedulesOperations + { + /// + /// Initializes a new instance of the ServiceFabricSchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServiceFabricSchedulesOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List schedules in a given service fabric. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (serviceFabricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("serviceFabricName", serviceFabricName); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string serviceFabricName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (serviceFabricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("serviceFabricName", serviceFabricName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string serviceFabricName, string name, Schedule schedule, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (serviceFabricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("serviceFabricName", serviceFabricName); + tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(schedule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); + } + System.Net.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; + } + + /// + /// Delete schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 labName, string userName, string serviceFabricName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (serviceFabricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("serviceFabricName", serviceFabricName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of schedules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string serviceFabricName, string name, ScheduleFragment schedule, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (serviceFabricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("serviceFabricName", serviceFabricName); + tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(schedule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); + } + System.Net.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; + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (serviceFabricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("serviceFabricName", serviceFabricName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// List schedules in a given service fabric. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..ef5012d3fd39 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServiceFabricSchedulesOperations. + /// + public static partial class ServiceFabricSchedulesOperationsExtensions + { + /// + /// List schedules in a given service fabric. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, userName, serviceFabricName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given service fabric. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, userName, serviceFabricName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + public static Schedule CreateOrUpdate(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Schedule schedule) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, serviceFabricName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, userName, serviceFabricName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + public static Schedule Update(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, ScheduleFragment schedule) + { + return operations.UpdateAsync(resourceGroupName, labName, userName, serviceFabricName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) + { + operations.ExecuteAsync(resourceGroupName, labName, userName, serviceFabricName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) + { + operations.BeginExecuteAsync(resourceGroupName, labName, userName, serviceFabricName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExecuteAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List schedules in a given service fabric. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IServiceFabricSchedulesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given service fabric. + /// + /// + /// 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 IServiceFabricSchedulesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperations.cs new file mode 100644 index 000000000000..06490f19d3a9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperations.cs @@ -0,0 +1,2052 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// ServiceFabricsOperations operations. + /// + internal partial class ServiceFabricsOperations : IServiceOperations, IServiceFabricsOperations + { + /// + /// Initializes a new instance of the ServiceFabricsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServiceFabricsOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List service fabrics in a given user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("userName", userName); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 service fabric. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=applicableSchedule)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing Service Fabric. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, serviceFabric, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete service fabric. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of service fabrics. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, ServiceFabricFragment serviceFabric, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (serviceFabric == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabric"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("serviceFabric", serviceFabric); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(serviceFabric != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(serviceFabric, 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); + } + System.Net.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 the applicable start/stop schedules, if any. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListApplicableSchedules", 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Start a service fabric. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stop a service fabric This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StopWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or replace an existing Service Fabric. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string userName, string name, ServiceFabric serviceFabric, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (serviceFabric == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabric"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("serviceFabric", serviceFabric); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(serviceFabric != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(serviceFabric, 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); + } + System.Net.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; + } + + /// + /// Delete service fabric. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Start a service fabric. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Stop a service fabric This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStop", 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// List service fabrics in a given user profile. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperationsExtensions.cs new file mode 100644 index 000000000000..4507e03fd7b3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperationsExtensions.cs @@ -0,0 +1,696 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServiceFabricsOperations. + /// + public static partial class ServiceFabricsOperationsExtensions + { + /// + /// List service fabrics in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, userName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List service fabrics in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get service fabric. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=applicableSchedule)' + /// + public static ServiceFabric Get(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, userName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get service fabric. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=applicableSchedule)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing Service Fabric. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + public static ServiceFabric CreateOrUpdate(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, name, serviceFabric).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Service Fabric. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, serviceFabric, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete service fabric. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + public static void Delete(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete service fabric. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of service fabrics. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + public static ServiceFabric Update(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabricFragment serviceFabric) + { + return operations.UpdateAsync(resourceGroupName, labName, userName, name, serviceFabric).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of service fabrics. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabricFragment serviceFabric, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, serviceFabric, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the applicable start/stop schedules, if any. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + public static ApplicableSchedule ListApplicableSchedules(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + return operations.ListApplicableSchedulesAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Lists the applicable start/stop schedules, if any. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task ListApplicableSchedulesAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListApplicableSchedulesWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Start a service fabric. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + public static void Start(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.StartAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Start a service fabric. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stop a service fabric This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + public static void Stop(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.StopAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Stop a service fabric This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or replace an existing Service Fabric. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + public static ServiceFabric BeginCreateOrUpdate(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, userName, name, serviceFabric).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Service Fabric. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// A Service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, serviceFabric, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete service fabric. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + public static void BeginDelete(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete service fabric. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Start a service fabric. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + public static void BeginStart(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.BeginStartAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Start a service fabric. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stop a service fabric This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + public static void BeginStop(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) + { + operations.BeginStopAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Stop a service fabric This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the service Fabric. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List service fabrics in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IServiceFabricsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List service fabrics in a given user profile. + /// + /// + /// 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 IServiceFabricsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs new file mode 100644 index 000000000000..d436fc9eae6c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs @@ -0,0 +1,1062 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// ServiceRunnersOperations operations. + /// + internal partial class ServiceRunnersOperations : IServiceOperations, IServiceRunnersOperations + { + /// + /// Initializes a new instance of the ServiceRunnersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServiceRunnersOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List service runners in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/servicerunners").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 service runner. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing Service runner. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// A container for a managed identity to execute DevTest lab 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ServiceRunner serviceRunner, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (serviceRunner == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceRunner"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("serviceRunner", serviceRunner); + 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.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(serviceRunner != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(serviceRunner, 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); + } + System.Net.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; + } + + /// + /// Delete service runner. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// List service runners in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs new file mode 100644 index 000000000000..0a5496deba78 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServiceRunnersOperations. + /// + public static partial class ServiceRunnersOperationsExtensions + { + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IServiceRunnersOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServiceRunnersOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + public static ServiceRunner Get(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name) + { + return operations.GetAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Get service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing Service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// A container for a managed identity to execute DevTest lab services. + /// + public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name, ServiceRunner serviceRunner) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, serviceRunner).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// A container for a managed identity to execute DevTest lab services. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name, ServiceRunner serviceRunner, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, serviceRunner, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + public static void Delete(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IServiceRunnersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List service runners in a given lab. + /// + /// + /// 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 IServiceRunnersOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs new file mode 100644 index 000000000000..cf41d091a4c5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs @@ -0,0 +1,1344 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// UsersOperations operations. + /// + internal partial class UsersOperations : IServiceOperations, IUsersOperations + { + /// + /// Initializes a new instance of the UsersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal UsersOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List user profiles in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/users").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 user profile. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing user profile. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, user, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of user profiles. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, UserFragment user, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (user == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "user"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("user", user); + 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.DevTestLab/labs/{labName}/users/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(user != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(user, 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); + } + System.Net.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 replace an existing user profile. This operation can take a while + /// to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, User user, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (user == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "user"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("user", user); + 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.DevTestLab/labs/{labName}/users/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(user != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(user, 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); + } + System.Net.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; + } + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/users/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 user profiles in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs new file mode 100644 index 000000000000..dbafd0da6ced --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs @@ -0,0 +1,404 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for UsersOperations. + /// + public static partial class UsersOperationsExtensions + { + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IUsersOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IUsersOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + public static User Get(this IUsersOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing user profile. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + public static User CreateOrUpdate(this IUsersOperations operations, string resourceGroupName, string labName, string name, User user) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, user).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing user profile. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, User user, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, user, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static void Delete(this IUsersOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of user profiles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + public static User Update(this IUsersOperations operations, string resourceGroupName, string labName, string name, UserFragment user) + { + return operations.UpdateAsync(resourceGroupName, labName, name, user).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of user profiles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, UserFragment user, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, user, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing user profile. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + public static User BeginCreateOrUpdate(this IUsersOperations operations, string resourceGroupName, string labName, string name, User user) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, user).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing user profile. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab user. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, User user, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, user, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static void BeginDelete(this IUsersOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IUsersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List user profiles in a given lab. + /// + /// + /// 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 IUsersOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs new file mode 100644 index 000000000000..e368d86af620 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs @@ -0,0 +1,1555 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// VirtualMachineSchedulesOperations operations. + /// + internal partial class VirtualMachineSchedulesOperations : IServiceOperations, IVirtualMachineSchedulesOperations + { + /// + /// Initializes a new instance of the VirtualMachineSchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineSchedulesOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List schedules in a given virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (virtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + 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.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string virtualMachineName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (virtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string virtualMachineName, string name, Schedule schedule, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (virtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + 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.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(schedule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); + } + System.Net.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; + } + + /// + /// Delete schedule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 labName, string virtualMachineName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (virtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Modify properties of schedules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string virtualMachineName, string name, ScheduleFragment schedule, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (virtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + 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.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(schedule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); + } + System.Net.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; + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (virtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", 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.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// List schedules in a given 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>> 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..75a38f17fbf6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs @@ -0,0 +1,433 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineSchedulesOperations. + /// + public static partial class VirtualMachineSchedulesOperationsExtensions + { + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, virtualMachineName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, virtualMachineName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, Schedule schedule) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, virtualMachineName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + public static Schedule Update(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, ScheduleFragment schedule) + { + return operations.UpdateAsync(resourceGroupName, labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name) + { + operations.ExecuteAsync(resourceGroupName, labName, virtualMachineName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name) + { + operations.BeginExecuteAsync(resourceGroupName, labName, virtualMachineName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExecuteAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineSchedulesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given 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> ListNextAsync(this IVirtualMachineSchedulesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs new file mode 100644 index 000000000000..4b46d6ef003e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs @@ -0,0 +1,4135 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// 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(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List virtual machines in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/virtualmachines").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labVirtualMachine, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of virtual machines. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (labVirtualMachine == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labVirtualMachine"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("labVirtualMachine", labVirtualMachine); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(labVirtualMachine != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, 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); + } + System.Net.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; + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task AddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginAddDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, dataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, applyArtifactsRequest, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginClaimWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDetachDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, detachDataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a string that represents the contents of the RDP file for the virtual + /// machine + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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> GetRdpFileContentsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRdpFileContents", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 the applicable start/stop schedules, if any. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListApplicableSchedules", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Redeploy a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Resize Virtual Machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for resizing a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginResizeWithHttpMessagesAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Restart a virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Transfers all data disks attached to the virtual machine to be owned by the + /// current user. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task TransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginTransferDisksWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Release ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task UnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUnClaimWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (labVirtualMachine == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labVirtualMachine"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("labVirtualMachine", labVirtualMachine); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(labVirtualMachine != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, 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); + } + System.Net.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; + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a 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 BeginAddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (dataDiskProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataDiskProperties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("dataDiskProperties", dataDiskProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginAddDataDisk", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(dataDiskProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataDiskProperties, 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); + } + System.Net.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; + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a 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 BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (applyArtifactsRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applyArtifactsRequest"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("applyArtifactsRequest", applyArtifactsRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginApplyArtifacts", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(applyArtifactsRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(applyArtifactsRequest, 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); + } + System.Net.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; + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginClaim", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/claim").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a 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 BeginDetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (detachDataDiskProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "detachDataDiskProperties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("detachDataDiskProperties", detachDataDiskProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDetachDataDisk", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(detachDataDiskProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(detachDataDiskProperties, 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); + } + System.Net.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; + } + + /// + /// Redeploy a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Resize Virtual Machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for resizing a 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 BeginResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (resizeLabVirtualMachineProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resizeLabVirtualMachineProperties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("resizeLabVirtualMachineProperties", resizeLabVirtualMachineProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginResize", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/resize").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(resizeLabVirtualMachineProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(resizeLabVirtualMachineProperties, 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); + } + System.Net.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; + } + + /// + /// Restart a virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}/restart").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}/start").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStop", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/stop").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Transfers all data disks attached to the virtual machine to be owned by the + /// current user. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginTransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginTransferDisks", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// Release ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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 BeginUnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUnClaim", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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; + } + + /// + /// List virtual machines in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs new file mode 100644 index 000000000000..11bf99f21bbe --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs @@ -0,0 +1,1518 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachinesOperations. + /// + public static partial class VirtualMachinesOperationsExtensions + { + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + public static LabVirtualMachine Get(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Delete(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + public static LabVirtualMachine Update(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine) + { + return operations.UpdateAsync(resourceGroupName, labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + public static void AddDataDisk(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties) + { + operations.AddDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task AddDataDiskAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AddDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + public static void ApplyArtifacts(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) + { + operations.ApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ApplyArtifactsAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Claim(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.ClaimAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ClaimAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ClaimWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + public static void DetachDataDisk(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) + { + operations.DetachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task DetachDataDiskAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DetachDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a string that represents the contents of the RDP file for the virtual + /// machine + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static RdpConnection GetRdpFileContents(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + return operations.GetRdpFileContentsAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Gets a string that represents the contents of the RDP file for the virtual + /// machine + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task GetRdpFileContentsAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRdpFileContentsWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the applicable start/stop schedules, if any. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static ApplicableSchedule ListApplicableSchedules(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + return operations.ListApplicableSchedulesAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Lists the applicable start/stop schedules, if any. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ListApplicableSchedulesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListApplicableSchedulesWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Redeploy a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Redeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.RedeployAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Redeploy a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Resize Virtual Machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for resizing a virtual machine. + /// + public static void Resize(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) + { + operations.ResizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties).GetAwaiter().GetResult(); + } + + /// + /// Resize Virtual Machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for resizing a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ResizeAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ResizeWithHttpMessagesAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restart a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Restart(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.RestartAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Restart a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Start(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.StartAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Stop(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.StopAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Transfers all data disks attached to the virtual machine to be owned by the + /// current user. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void TransferDisks(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.TransferDisksAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Transfers all data disks attached to the virtual machine to be owned by the + /// current user. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task TransferDisksAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.TransferDisksWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Release ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void UnClaim(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.UnClaimAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Release ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task UnClaimAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UnClaimWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginDelete(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties) + { + operations.BeginAddDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginAddDataDiskAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginAddDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + public static void BeginApplyArtifacts(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) + { + operations.BeginApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginApplyArtifactsAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginClaim(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginClaimAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginClaimAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginClaimWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + public static void BeginDetachDataDisk(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) + { + operations.BeginDetachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDetachDataDiskAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDetachDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Redeploy a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginRedeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginRedeployAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Redeploy a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Resize Virtual Machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for resizing a virtual machine. + /// + public static void BeginResize(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) + { + operations.BeginResizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties).GetAwaiter().GetResult(); + } + + /// + /// Resize Virtual Machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for resizing a virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginResizeAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginResizeWithHttpMessagesAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restart a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginRestart(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginRestartAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Restart a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginStart(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginStartAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginStop(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginStopAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Transfers all data disks attached to the virtual machine to be owned by the + /// current user. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginTransferDisks(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginTransferDisksAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Transfers all data disks attached to the virtual machine to be owned by the + /// current user. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginTransferDisksAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginTransferDisksWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Release ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginUnClaim(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginUnClaimAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Release ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUnClaimAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginUnClaimWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List virtual machines in a given lab. + /// + /// + /// 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(); + } + + /// + /// List virtual machines in a given lab. + /// + /// + /// 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; + } + } + + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs new file mode 100644 index 000000000000..01098e514910 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs @@ -0,0 +1,1344 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + 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; + + /// + /// VirtualNetworksOperations operations. + /// + internal partial class VirtualNetworksOperations : IServiceOperations, IVirtualNetworksOperations + { + /// + /// Initializes a new instance of the VirtualNetworksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualNetworksOperations(DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List virtual networks in a given lab. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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("labName", labName); + 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.DevTestLab/labs/{labName}/virtualnetworks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 virtual network. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, virtualNetwork, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of virtual networks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, VirtualNetworkFragment virtualNetwork, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (virtualNetwork == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetwork"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("virtualNetwork", virtualNetwork); + 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.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(virtualNetwork != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(virtualNetwork, 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); + } + System.Net.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 replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 labName, string name, VirtualNetwork virtualNetwork, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (virtualNetwork == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetwork"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("virtualNetwork", virtualNetwork); + 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.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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(virtualNetwork != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(virtualNetwork, 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); + } + System.Net.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; + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// 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 labName, string name, 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 (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + 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.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_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); + } + System.Net.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 virtual networks in a given lab. + /// + /// + /// 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); + } + System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs new file mode 100644 index 000000000000..cc8334a6dd40 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs @@ -0,0 +1,404 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualNetworksOperations. + /// + public static partial class VirtualNetworksOperationsExtensions + { + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage List(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get virtual network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + public static VirtualNetwork Get(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get virtual network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork) + { + return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static void Delete(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name) + { + operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Modify properties of virtual networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + public static VirtualNetwork Update(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetworkFragment virtualNetwork) + { + return operations.UpdateAsync(resourceGroupName, labName, name, virtualNetwork).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of virtual networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetworkFragment virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static void BeginDelete(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualNetworksOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List virtual networks in a given lab. + /// + /// + /// 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 IVirtualNetworksOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Properties/AssemblyInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..a035489e49b9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// 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 - DevTest Labs Management 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: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.2.0")] \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md new file mode 100644 index 000000000000..0c9e1e09bf7a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md @@ -0,0 +1,34 @@ +# Overall +This directory contains management plane service clients of Az.Storage 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 +``` + + + +### +``` yaml +commit: eae134537e7fd35e5bcbae4eda564d91933e9257 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/DTL.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.DevTestLabs +``` \ No newline at end of file From 1d14a689e7955906e5f79a8f288eba22585529d7 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:54:57 +0800 Subject: [PATCH 2/8] add DevTestLabs.Management.Sdk --- .../DevTestLabs.Management.Sdk/README.md | 2 +- .../DevTestLabs.Test/DevTestLabs.Test.csproj | 2 +- src/DevTestLabs/DevTestLabs.sln | 30 +++++++++++-------- .../DevTestLabs/DevTestLabs.csproj | 6 ++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md index 0c9e1e09bf7a..633bcc4c89af 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md @@ -24,7 +24,7 @@ license-header: MICROSOFT_MIT_NO_VERSION ### ``` yaml -commit: eae134537e7fd35e5bcbae4eda564d91933e9257 +commit: d4365e634050481a5d6966cd6dd2e4a361d519dd input-file: - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/DTL.json diff --git a/src/DevTestLabs/DevTestLabs.Test/DevTestLabs.Test.csproj b/src/DevTestLabs/DevTestLabs.Test/DevTestLabs.Test.csproj index 901f61db6774..0b3f317c0b9d 100644 --- a/src/DevTestLabs/DevTestLabs.Test/DevTestLabs.Test.csproj +++ b/src/DevTestLabs/DevTestLabs.Test/DevTestLabs.Test.csproj @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.sln b/src/DevTestLabs/DevTestLabs.sln index 6d9b1812a1a9..325d16746249 100644 --- a/src/DevTestLabs/DevTestLabs.sln +++ b/src/DevTestLabs/DevTestLabs.sln @@ -5,34 +5,33 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accounts", "Accounts", "{3F69E5C5-71CF-4683-A9C8-53BA3A1A5DDF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{CEFF4657-4F89-46F5-8E72-F90173138BBA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{CEFF4657-4F89-46F5-8E72-F90173138BBA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{E903475C-3239-4E44-91C0-DBA7B39FB376}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{E903475C-3239-4E44-91C0-DBA7B39FB376}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{A8979AB2-A238-40CC-BEB2-89CEE302F440}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{A8979AB2-A238-40CC-BEB2-89CEE302F440}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{275B3E87-091D-4199-A437-EACC6D78921D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{275B3E87-091D-4199-A437-EACC6D78921D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{F2A68427-CD57-4A36-B602-21E00A01C731}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{F2A68427-CD57-4A36-B602-21E00A01C731}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{AA4EFB70-22FE-41C0-9179-6BF1422E7B0D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{AA4EFB70-22FE-41C0-9179-6BF1422E7B0D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{222F330A-327F-4122-AE98-B948918EF747}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevTestLabs.Test", "DevTestLabs.Test\DevTestLabs.Test.csproj", "{47D9666F-225C-469C-98F1-BF687A115975}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevTestLabs.Test", "DevTestLabs.Test\DevTestLabs.Test.csproj", "{47D9666F-225C-469C-98F1-BF687A115975}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevTestLabs", "DevTestLabs\DevTestLabs.csproj", "{F1CA7D35-9D66-4C8E-82C8-BD2AE52133D6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevTestLabs", "DevTestLabs\DevTestLabs.csproj", "{F1CA7D35-9D66-4C8E-82C8-BD2AE52133D6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{61354667-C9E3-45E3-9515-73060817E727}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{61354667-C9E3-45E3-9515-73060817E727}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevTestLabs.Management.Sdk", "DevTestLabs.Management.Sdk\DevTestLabs.Management.Sdk.csproj", "{DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {CEFF4657-4F89-46F5-8E72-F90173138BBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEFF4657-4F89-46F5-8E72-F90173138BBA}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -70,6 +69,13 @@ Global {61354667-C9E3-45E3-9515-73060817E727}.Debug|Any CPU.Build.0 = Debug|Any CPU {61354667-C9E3-45E3-9515-73060817E727}.Release|Any CPU.ActiveCfg = Release|Any CPU {61354667-C9E3-45E3-9515-73060817E727}.Release|Any CPU.Build.0 = Release|Any CPU + {DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {CEFF4657-4F89-46F5-8E72-F90173138BBA} = {3F69E5C5-71CF-4683-A9C8-53BA3A1A5DDF} diff --git a/src/DevTestLabs/DevTestLabs/DevTestLabs.csproj b/src/DevTestLabs/DevTestLabs/DevTestLabs.csproj index bfc412a1bd48..5fdd2648ae84 100644 --- a/src/DevTestLabs/DevTestLabs/DevTestLabs.csproj +++ b/src/DevTestLabs/DevTestLabs/DevTestLabs.csproj @@ -10,10 +10,10 @@ $(LegacyAssemblyPrefix)$(PsModuleName) + + - + - - From d4c7c05b69b5c44ca6bce1f9dc180d532d32daed Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:41:51 +0800 Subject: [PATCH 3/8] use 2016-05-15 api vesion --- .../Generated/ArmTemplatesOperations.cs | 24 +- .../ArmTemplatesOperationsExtensions.cs | 28 +- .../Generated/ArtifactSourcesOperations.cs | 60 +- .../ArtifactSourcesOperationsExtensions.cs | 70 +- .../Generated/ArtifactsOperations.cs | 36 +- .../ArtifactsOperationsExtensions.cs | 42 +- .../Generated/CostsOperations.cs | 24 +- .../Generated/CostsOperationsExtensions.cs | 28 +- .../Generated/CustomImagesOperations.cs | 283 +-- .../CustomImagesOperationsExtensions.cs | 136 +- .../Generated/DevTestLabsClient.cs | 19 +- .../Generated/DisksOperations.cs | 330 +-- .../Generated/DisksOperationsExtensions.cs | 198 +- .../Generated/EnvironmentsOperations.cs | 292 +-- .../EnvironmentsOperationsExtensions.cs | 142 +- .../Generated/FormulasOperations.cs | 274 +-- .../Generated/FormulasOperationsExtensions.cs | 122 +- .../Generated/GalleryImagesOperations.cs | 12 +- .../GalleryImagesOperationsExtensions.cs | 14 +- .../Generated/GlobalSchedulesOperations.cs | 98 +- .../GlobalSchedulesOperationsExtensions.cs | 126 +- .../Generated/IArmTemplatesOperations.cs | 10 +- .../Generated/IArtifactSourcesOperations.cs | 25 +- .../Generated/IArtifactsOperations.cs | 15 +- .../Generated/ICostsOperations.cs | 10 +- .../Generated/ICustomImagesOperations.cs | 61 +- .../Generated/IDevTestLabsClient.cs | 15 +- .../Generated/IDisksOperations.cs | 84 +- .../Generated/IEnvironmentsOperations.cs | 64 +- .../Generated/IFormulasOperations.cs | 57 +- .../Generated/IGalleryImagesOperations.cs | 5 +- .../Generated/IGlobalSchedulesOperations.cs | 45 +- .../Generated/ILabsOperations.cs | 129 +- .../INotificationChannelsOperations.cs | 30 +- .../Generated/IPoliciesOperations.cs | 25 +- .../Generated/IPolicySetsOperations.cs | 5 +- .../Generated/ISchedulesOperations.cs | 40 +- .../Generated/ISecretsOperations.cs | 92 +- .../IServiceFabricSchedulesOperations.cs | 288 --- .../Generated/IServiceFabricsOperations.cs | 421 ---- .../Generated/IServiceRunnersOperations.cs | 20 +- .../Generated/IUsersOperations.cs | 65 +- .../IVirtualMachineSchedulesOperations.cs | 35 +- .../Generated/IVirtualMachinesOperations.cs | 399 +--- .../Generated/IVirtualNetworksOperations.cs | 35 +- .../Generated/LabsOperations.cs | 375 +-- .../Generated/LabsOperationsExtensions.cs | 304 +-- .../Models/ApplicableScheduleFragment.cs | 10 +- .../Generated/Models/ArmTemplate.cs | 11 +- .../ArmTemplateParameterPropertiesFragment.cs | 61 - .../Models/ArtifactInstallProperties.cs | 10 +- .../ArtifactInstallPropertiesFragment.cs | 10 +- .../Generated/Models/ArtifactSource.cs | 8 +- .../Models/ArtifactSourceFragment.cs | 28 +- .../AttachNewDataDiskOptionsFragment.cs | 73 - .../Models/BulkCreationParametersFragment.cs | 54 - .../Generated/Models/CustomImage.cs | 50 +- .../Generated/Models/CustomImageFragment.cs | 135 -- .../CustomImagePropertiesCustomFragment.cs | 72 - .../Models/CustomImagePropertiesFromPlan.cs | 74 - .../CustomImagePropertiesFromPlanFragment.cs | 74 - .../CustomImagePropertiesFromVmFragment.cs | 71 - .../Models/DataDiskPropertiesFragment.cs | 76 - .../Models/DataDiskStorageTypeInfo.cs | 61 - .../Models/DataDiskStorageTypeInfoFragment.cs | 63 - .../Generated/Models/Disk.cs | 8 +- .../Generated/Models/DiskFragment.cs | 119 - .../Generated/Models/DtlEnvironment.cs | 8 +- .../Models/DtlEnvironmentFragment.cs | 69 - ...EnvironmentDeploymentPropertiesFragment.cs | 65 - .../Models/EvaluatePoliciesProperties.cs | 11 +- .../Generated/Models/Formula.cs | 8 +- .../Generated/Models/FormulaFragment.cs | 93 - .../Models/FormulaPropertiesFromVmFragment.cs | 55 - .../Generated/Models/GalleryImage.cs | 21 +- .../Models/ImportLabVirtualMachineRequest.cs | 65 - .../Generated/Models/Lab.cs | 118 +- .../Models/LabAnnouncementProperties.cs | 109 - .../LabAnnouncementPropertiesFragment.cs | 93 - .../Generated/Models/LabCost.cs | 8 +- .../Generated/Models/LabFragment.cs | 84 +- .../Generated/Models/LabSupportProperties.cs | 64 - .../Models/LabSupportPropertiesFragment.cs | 66 - .../Generated/Models/LabVirtualMachine.cs | 62 +- .../LabVirtualMachineCreationParameter.cs | 68 +- ...VirtualMachineCreationParameterFragment.cs | 377 --- .../Models/LabVirtualMachineFragment.cs | 76 +- .../Generated/Models/LinuxOsInfoFragment.cs | 56 - .../Generated/Models/NotificationChannel.cs | 31 +- .../Models/NotificationChannelFragment.cs | 49 +- .../Generated/Models/NotificationSettings.cs | 29 +- .../Models/NotificationSettingsFragment.cs | 29 +- ...entPermission.cs => NotificationStatus.cs} | 8 +- .../Generated/Models/Policy.cs | 14 +- .../Generated/Models/PolicyFactName.cs | 2 - .../Generated/Models/PolicyFragment.cs | 34 +- .../Generated/Models/RdpConnection.cs | 51 - .../ResizeLabVirtualMachineProperties.cs | 54 - .../Generated/Models/Schedule.cs | 8 +- .../Models/ScheduleCreationParameter.cs | 150 -- .../ScheduleCreationParameterFragment.cs | 152 -- .../Generated/Models/ScheduleFragment.cs | 28 +- .../Generated/Models/Secret.cs | 8 +- .../Generated/Models/SecretFragment.cs | 59 - .../Generated/Models/ServiceFabric.cs | 100 - .../Generated/Models/ServiceFabricFragment.cs | 69 - .../Models/ShutdownNotificationContent.cs | 19 +- .../Generated/Models/UpdateResource.cs | 53 - .../Generated/Models/User.cs | 8 +- .../Generated/Models/UserFragment.cs | 28 +- .../Generated/Models/VirtualNetwork.cs | 12 +- .../Models/VirtualNetworkFragment.cs | 37 +- .../Generated/Models/WindowsOsInfoFragment.cs | 56 - .../NotificationChannelsOperations.cs | 72 +- ...otificationChannelsOperationsExtensions.cs | 84 +- .../Generated/PoliciesOperations.cs | 60 +- .../Generated/PoliciesOperationsExtensions.cs | 70 +- .../Generated/PolicySetsOperations.cs | 12 +- .../PolicySetsOperationsExtensions.cs | 14 +- .../Generated/SchedulesOperations.cs | 91 +- .../SchedulesOperationsExtensions.cs | 112 +- .../Generated/SdkInfo_DevTestLabsClient.cs | 48 +- .../Generated/SecretsOperations.cs | 363 +-- .../Generated/SecretsOperationsExtensions.cs | 180 +- .../ServiceFabricSchedulesOperations.cs | 1612 ------------- ...viceFabricSchedulesOperationsExtensions.cs | 475 ---- .../Generated/ServiceFabricsOperations.cs | 2052 ----------------- .../ServiceFabricsOperationsExtensions.cs | 696 ------ .../Generated/ServiceRunnersOperations.cs | 48 +- .../ServiceRunnersOperationsExtensions.cs | 56 +- .../Generated/UsersOperations.cs | 189 +- .../Generated/UsersOperationsExtensions.cs | 144 +- .../VirtualMachineSchedulesOperations.cs | 79 +- ...ualMachineSchedulesOperationsExtensions.cs | 98 +- .../Generated/VirtualMachinesOperations.cs | 1920 +++------------ .../VirtualMachinesOperationsExtensions.cs | 782 +------ .../Generated/VirtualNetworksOperations.cs | 76 +- .../VirtualNetworksOperationsExtensions.cs | 98 +- .../DevTestLabs.Management.Sdk/README.md | 16 +- .../DevTestLabs/Az.DevTestLabs.psd1 | 2 +- 140 files changed, 1828 insertions(+), 16365 deletions(-) delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricSchedulesOperations.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricsOperations.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterPropertiesFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptionsFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParametersFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustomFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlan.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlanFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVmFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskPropertiesFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfo.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfoFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironmentFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentPropertiesFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVmFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ImportLabVirtualMachineRequest.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementProperties.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementPropertiesFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportProperties.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportPropertiesFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfoFragment.cs rename src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/{EnvironmentPermission.cs => NotificationStatus.cs} (69%) delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RdpConnection.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ResizeLabVirtualMachineProperties.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameter.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameterFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabric.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabricFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UpdateResource.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfoFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperations.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperationsExtensions.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperations.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperationsExtensions.cs diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs index ec387a5bacf8..2c6ee783ea9d 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs @@ -54,9 +54,6 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// List azure resource manager templates in a given artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -87,15 +84,15 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -117,7 +114,6 @@ internal ArmTemplatesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,7 +123,7 @@ internal ArmTemplatesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); List _queryParameters = new List(); @@ -271,9 +267,6 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// Get azure resource manager template. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -307,15 +300,15 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -340,7 +333,6 @@ internal ArmTemplatesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); tracingParameters.Add("name", name); @@ -352,7 +344,7 @@ internal ArmTemplatesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs index afc94bbbd57a..bd53c1415237 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs @@ -28,9 +28,6 @@ public static partial class ArmTemplatesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -40,9 +37,9 @@ public static partial class ArmTemplatesOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage List(this IArmTemplatesOperations operations, string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IArmTemplatesOperations operations, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); } /// @@ -51,9 +48,6 @@ public static partial class ArmTemplatesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -66,9 +60,9 @@ public static partial class ArmTemplatesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IArmTemplatesOperations operations, string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IArmTemplatesOperations operations, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -80,9 +74,6 @@ public static partial class ArmTemplatesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -95,9 +86,9 @@ public static partial class ArmTemplatesOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=displayName)' /// - public static ArmTemplate Get(this IArmTemplatesOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string)) + public static ArmTemplate Get(this IArmTemplatesOperations operations, string labName, string artifactSourceName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); } /// @@ -106,9 +97,6 @@ public static partial class ArmTemplatesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -124,9 +112,9 @@ public static partial class ArmTemplatesOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IArmTemplatesOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IArmTemplatesOperations operations, string labName, string artifactSourceName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs index 63061ca56f84..af90c5cb9973 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs @@ -54,9 +54,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// List artifact sources in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// Get artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -295,15 +288,15 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -324,7 +317,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -335,7 +327,7 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -475,9 +467,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// Create or replace an existing artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -508,15 +497,15 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ArtifactSource artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ArtifactSource artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -541,7 +530,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("artifactSource", artifactSource); @@ -552,7 +540,7 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -712,9 +700,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// Delete artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -739,15 +724,15 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -768,7 +753,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -778,7 +762,7 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -896,9 +880,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// Modify properties of artifact sources. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -929,15 +910,15 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ArtifactSourceFragment artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string labName, string name, ArtifactSourceFragment artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -962,7 +943,6 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("artifactSource", artifactSource); @@ -973,7 +953,7 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs index fe37b564812f..b8ca51615f84 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IArtifactSourcesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IArtifactSourcesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,9 +68,6 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,9 +77,9 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=displayName)' /// - public static ArtifactSource Get(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static ArtifactSource Get(this IArtifactSourcesOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -97,9 +88,6 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -112,9 +100,9 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IArtifactSourcesOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -126,9 +114,6 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -138,9 +123,9 @@ public static partial class ArtifactSourcesOperationsExtensions /// /// Properties of an artifact source. /// - public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, ArtifactSource artifactSource) + public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSource artifactSource) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, artifactSource).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, artifactSource).GetAwaiter().GetResult(); } /// @@ -149,9 +134,6 @@ public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations oper /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -164,9 +146,9 @@ public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations oper /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, ArtifactSource artifactSource, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSource artifactSource, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -178,18 +160,15 @@ public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations oper /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the artifact source. /// - public static void Delete(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this IArtifactSourcesOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -198,9 +177,6 @@ public static void Delete(this IArtifactSourcesOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -210,9 +186,9 @@ public static void Delete(this IArtifactSourcesOperations operations, string res /// /// The cancellation token. /// - public static async Task DeleteAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IArtifactSourcesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -221,9 +197,6 @@ public static void Delete(this IArtifactSourcesOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -233,9 +206,9 @@ public static void Delete(this IArtifactSourcesOperations operations, string res /// /// Properties of an artifact source. /// - public static ArtifactSource Update(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, ArtifactSourceFragment artifactSource) + public static ArtifactSource Update(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSourceFragment artifactSource) { - return operations.UpdateAsync(resourceGroupName, labName, name, artifactSource).GetAwaiter().GetResult(); + return operations.UpdateAsync(labName, name, artifactSource).GetAwaiter().GetResult(); } /// @@ -244,9 +217,6 @@ public static ArtifactSource Update(this IArtifactSourcesOperations operations, /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -259,9 +229,9 @@ public static ArtifactSource Update(this IArtifactSourcesOperations operations, /// /// The cancellation token. /// - public static async Task UpdateAsync(this IArtifactSourcesOperations operations, string resourceGroupName, string labName, string name, ArtifactSourceFragment artifactSource, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSourceFragment artifactSource, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs index ab7a2811546d..8ff9a806f6c5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs @@ -54,9 +54,6 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// List artifacts in a given artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -87,15 +84,15 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -117,7 +114,6 @@ internal ArtifactsOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,7 +123,7 @@ internal ArtifactsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); List _queryParameters = new List(); @@ -271,9 +267,6 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// Get artifact. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -307,15 +300,15 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -340,7 +333,6 @@ internal ArtifactsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); tracingParameters.Add("name", name); @@ -352,7 +344,7 @@ internal ArtifactsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -494,9 +486,6 @@ internal ArtifactsOperations(DevTestLabsClient client) /// Generates an ARM template for the given artifact, uploads the required /// files to a storage account, and validates the generated artifact. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -530,15 +519,15 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GenerateArmTemplateWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GenerateArmTemplateWithHttpMessagesAsync(string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -567,7 +556,6 @@ internal ArtifactsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); tracingParameters.Add("name", name); @@ -579,7 +567,7 @@ internal ArtifactsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs index 207fbb2fe011..4f66a52b6113 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs @@ -28,9 +28,6 @@ public static partial class ArtifactsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -40,9 +37,9 @@ public static partial class ArtifactsOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage List(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IArtifactsOperations operations, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); } /// @@ -51,9 +48,6 @@ public static partial class ArtifactsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -66,9 +60,9 @@ public static partial class ArtifactsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -80,9 +74,6 @@ public static partial class ArtifactsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -95,9 +86,9 @@ public static partial class ArtifactsOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=title)' /// - public static Artifact Get(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string)) + public static Artifact Get(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); } /// @@ -106,9 +97,6 @@ public static partial class ArtifactsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -124,9 +112,9 @@ public static partial class ArtifactsOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -139,9 +127,6 @@ public static partial class ArtifactsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -154,9 +139,9 @@ public static partial class ArtifactsOperationsExtensions /// /// Parameters for generating an ARM template for deploying artifacts. /// - public static ArmTemplateInfo GenerateArmTemplate(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest) + public static ArmTemplateInfo GenerateArmTemplate(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest) { - return operations.GenerateArmTemplateAsync(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest).GetAwaiter().GetResult(); + return operations.GenerateArmTemplateAsync(labName, artifactSourceName, name, generateArmTemplateRequest).GetAwaiter().GetResult(); } /// @@ -166,9 +151,6 @@ public static ArmTemplateInfo GenerateArmTemplate(this IArtifactsOperations oper /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -184,9 +166,9 @@ public static ArmTemplateInfo GenerateArmTemplate(this IArtifactsOperations oper /// /// The cancellation token. /// - public static async Task GenerateArmTemplateAsync(this IArtifactsOperations operations, string resourceGroupName, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GenerateArmTemplateAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GenerateArmTemplateWithHttpMessagesAsync(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GenerateArmTemplateWithHttpMessagesAsync(labName, artifactSourceName, name, generateArmTemplateRequest, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs index e4131f6acdc6..11e3ff7bbbf4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs @@ -53,9 +53,6 @@ internal CostsOperations(DevTestLabsClient client) /// /// Get cost. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,15 +83,15 @@ internal CostsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -115,7 +112,6 @@ internal CostsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -126,7 +122,7 @@ internal CostsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -266,9 +262,6 @@ internal CostsOperations(DevTestLabsClient client) /// /// Create or replace an existing cost. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -299,15 +292,15 @@ internal CostsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabCost labCost, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabCost labCost, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -332,7 +325,6 @@ internal CostsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("labCost", labCost); @@ -343,7 +335,7 @@ internal CostsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs index 499d0b1d761f..080159be0bae 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs @@ -27,9 +27,6 @@ public static partial class CostsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -39,9 +36,9 @@ public static partial class CostsOperationsExtensions /// /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' /// - public static LabCost Get(this ICostsOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static LabCost Get(this ICostsOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -50,9 +47,6 @@ public static partial class CostsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -65,9 +59,9 @@ public static partial class CostsOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this ICostsOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ICostsOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -79,9 +73,6 @@ public static partial class CostsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -91,9 +82,9 @@ public static partial class CostsOperationsExtensions /// /// A cost item. /// - public static LabCost CreateOrUpdate(this ICostsOperations operations, string resourceGroupName, string labName, string name, LabCost labCost) + public static LabCost CreateOrUpdate(this ICostsOperations operations, string labName, string name, LabCost labCost) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, labCost).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, labCost).GetAwaiter().GetResult(); } /// @@ -102,9 +93,6 @@ public static LabCost CreateOrUpdate(this ICostsOperations operations, string re /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -117,9 +105,9 @@ public static LabCost CreateOrUpdate(this ICostsOperations operations, string re /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ICostsOperations operations, string resourceGroupName, string labName, string name, LabCost labCost, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ICostsOperations operations, string labName, string name, LabCost labCost, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labCost, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, labCost, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs index 225a8c040b9a..7ffc23ae1faa 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs @@ -54,9 +54,6 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// List custom images in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal CustomImagesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal CustomImagesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// Get custom image. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -295,15 +288,15 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -324,7 +317,6 @@ internal CustomImagesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -335,7 +327,7 @@ internal CustomImagesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -476,9 +468,6 @@ internal CustomImagesOperations(DevTestLabsClient client) /// Create or replace an existing custom image. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -494,19 +483,16 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, customImage, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Delete custom image. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -519,239 +505,17 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// Modify properties of custom images. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// A custom image. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string name, CustomImageFragment customImage, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (customImage == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "customImage"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("customImage", customImage); - 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.DevTestLab/labs/{labName}/customimages/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(customImage != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(customImage, 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); - } - System.Net.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 replace an existing custom image. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -782,15 +546,15 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -819,7 +583,6 @@ internal CustomImagesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("customImage", customImage); @@ -830,7 +593,7 @@ internal CustomImagesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -990,9 +753,6 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// Delete custom image. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1017,15 +777,15 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1046,7 +806,6 @@ internal CustomImagesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1056,7 +815,7 @@ internal CustomImagesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -1122,7 +881,7 @@ internal CustomImagesOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs index d600fc47b4d0..67bb34be3d47 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class CustomImagesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this ICustomImagesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this ICustomImagesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class CustomImagesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class CustomImagesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this ICustomImagesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,9 +68,6 @@ public static partial class CustomImagesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,9 +77,9 @@ public static partial class CustomImagesOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=vm)' /// - public static CustomImage Get(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static CustomImage Get(this ICustomImagesOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -97,9 +88,6 @@ public static partial class CustomImagesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -112,9 +100,9 @@ public static partial class CustomImagesOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ICustomImagesOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -127,9 +115,6 @@ public static partial class CustomImagesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -139,9 +124,9 @@ public static partial class CustomImagesOperationsExtensions /// /// A custom image. /// - public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImage customImage) + public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, customImage).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, customImage).GetAwaiter().GetResult(); } /// @@ -151,9 +136,6 @@ public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -166,9 +148,9 @@ public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImage customImage, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -180,18 +162,15 @@ public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the custom image. /// - public static void Delete(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this ICustomImagesOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -200,73 +179,18 @@ public static void Delete(this ICustomImagesOperations operations, string resour /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of custom images. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// A custom image. - /// - public static CustomImage Update(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImageFragment customImage) - { - return operations.UpdateAsync(resourceGroupName, labName, name, customImage).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of custom images. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the custom image. /// - /// - /// A custom image. - /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImageFragment customImage, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this ICustomImagesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -276,9 +200,6 @@ public static CustomImage Update(this ICustomImagesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -288,9 +209,9 @@ public static CustomImage Update(this ICustomImagesOperations operations, string /// /// A custom image. /// - public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImage customImage) + public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, customImage).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(labName, name, customImage).GetAwaiter().GetResult(); } /// @@ -300,9 +221,6 @@ public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations opera /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -315,9 +233,9 @@ public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations opera /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CustomImage customImage, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -329,18 +247,15 @@ public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations opera /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the custom image. /// - public static void BeginDelete(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name) + public static void BeginDelete(this ICustomImagesOperations operations, string labName, string name) { - operations.BeginDeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -349,9 +264,6 @@ public static void BeginDelete(this ICustomImagesOperations operations, string r /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -361,9 +273,9 @@ public static void BeginDelete(this ICustomImagesOperations operations, string r /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this ICustomImagesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this ICustomImagesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs index 806b878deb1d..89e5e662c07f 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs @@ -51,6 +51,11 @@ public partial class DevTestLabsClient : ServiceClient, IDevT /// public string ApiVersion { get; private set; } + /// + /// The name of the resource group. + /// + public string ResourceGroupName { get; set; } + /// /// The subscription ID. /// @@ -174,16 +179,6 @@ public partial class DevTestLabsClient : ServiceClient, IDevT /// public virtual ISecretsOperations Secrets { get; private set; } - /// - /// Gets the IServiceFabricsOperations. - /// - public virtual IServiceFabricsOperations ServiceFabrics { get; private set; } - - /// - /// Gets the IServiceFabricSchedulesOperations. - /// - public virtual IServiceFabricSchedulesOperations ServiceFabricSchedules { get; private set; } - /// /// Gets the IVirtualMachinesOperations. /// @@ -460,13 +455,11 @@ private void Initialize() Disks = new DisksOperations(this); Environments = new EnvironmentsOperations(this); Secrets = new SecretsOperations(this); - ServiceFabrics = new ServiceFabricsOperations(this); - ServiceFabricSchedules = new ServiceFabricSchedulesOperations(this); VirtualMachines = new VirtualMachinesOperations(this); VirtualMachineSchedules = new VirtualMachineSchedulesOperations(this); VirtualNetworks = new VirtualNetworksOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-09-15"; + ApiVersion = "2016-05-15"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs index 1f6e18917d74..77c93b98bc40 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs @@ -54,9 +54,6 @@ internal DisksOperations(DevTestLabsClient client) /// /// List disks in a given user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -87,15 +84,15 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -117,7 +114,6 @@ internal DisksOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,7 +123,7 @@ internal DisksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); List _queryParameters = new List(); @@ -271,9 +267,6 @@ internal DisksOperations(DevTestLabsClient client) /// /// Get disk. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -307,15 +300,15 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string userName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -340,7 +333,6 @@ internal DisksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -352,7 +344,7 @@ internal DisksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -494,9 +486,6 @@ internal DisksOperations(DevTestLabsClient client) /// Create or replace an existing disk. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -515,19 +504,16 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, disk, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Delete disk. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -543,248 +529,17 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// Modify properties of disks. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// A Disk. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string userName, string name, DiskFragment 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (disk == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "disk"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - tracingParameters.Add("disk", disk); - 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.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - /// /// Attach and create the lease of the disk to the virtual machine. This /// operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -803,10 +558,10 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task AttachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task AttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginAttachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, attachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginAttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -814,9 +569,6 @@ internal DisksOperations(DevTestLabsClient client) /// Detach and break the lease of the disk attached to the virtual machine. /// This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -835,10 +587,10 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task DetachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDetachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, detachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -846,9 +598,6 @@ internal DisksOperations(DevTestLabsClient client) /// Create or replace an existing disk. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -882,15 +631,15 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -919,7 +668,6 @@ internal DisksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -931,7 +679,7 @@ internal DisksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -1092,9 +840,6 @@ internal DisksOperations(DevTestLabsClient client) /// /// Delete disk. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1122,15 +867,15 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1155,7 +900,6 @@ internal DisksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -1166,7 +910,7 @@ internal DisksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -1233,7 +977,7 @@ internal DisksOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1286,9 +1030,6 @@ internal DisksOperations(DevTestLabsClient client) /// Attach and create the lease of the disk to the virtual machine. This /// operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1319,15 +1060,15 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginAttachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginAttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1356,7 +1097,6 @@ internal DisksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -1368,7 +1108,7 @@ internal DisksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -1494,9 +1234,6 @@ internal DisksOperations(DevTestLabsClient client) /// Detach and break the lease of the disk attached to the virtual machine. /// This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1527,15 +1264,15 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDetachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1564,7 +1301,6 @@ internal DisksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -1576,7 +1312,7 @@ internal DisksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs index f2e41ff0a3ca..84553486368a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs @@ -28,9 +28,6 @@ public static partial class DisksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -40,9 +37,9 @@ public static partial class DisksOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage List(this IDisksOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IDisksOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, userName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); } /// @@ -51,9 +48,6 @@ public static partial class DisksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -66,9 +60,9 @@ public static partial class DisksOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IDisksOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -80,9 +74,6 @@ public static partial class DisksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -95,9 +86,9 @@ public static partial class DisksOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=diskType)' /// - public static Disk Get(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string)) + public static Disk Get(this IDisksOperations operations, string labName, string userName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, userName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); } /// @@ -106,9 +97,6 @@ public static partial class DisksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -124,9 +112,9 @@ public static partial class DisksOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IDisksOperations operations, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -139,9 +127,6 @@ public static partial class DisksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -154,9 +139,9 @@ public static partial class DisksOperationsExtensions /// /// A Disk. /// - public static Disk CreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, Disk disk) + public static Disk CreateOrUpdate(this IDisksOperations operations, string labName, string userName, string name, Disk disk) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, name, disk).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, userName, name, disk).GetAwaiter().GetResult(); } /// @@ -166,9 +151,6 @@ public static Disk CreateOrUpdate(this IDisksOperations operations, string resou /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -184,9 +166,9 @@ public static Disk CreateOrUpdate(this IDisksOperations operations, string resou /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IDisksOperations operations, string labName, string userName, string name, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -198,9 +180,6 @@ public static Disk CreateOrUpdate(this IDisksOperations operations, string resou /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -210,9 +189,9 @@ public static Disk CreateOrUpdate(this IDisksOperations operations, string resou /// /// The name of the disk. /// - public static void Delete(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name) + public static void Delete(this IDisksOperations operations, string labName, string userName, string name) { - operations.DeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); } /// @@ -221,61 +200,6 @@ public static void Delete(this IDisksOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of disks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// A Disk. - /// - public static Disk Update(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DiskFragment disk) - { - return operations.UpdateAsync(resourceGroupName, labName, userName, name, disk).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of disks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -285,18 +209,12 @@ public static Disk Update(this IDisksOperations operations, string resourceGroup /// /// The name of the disk. /// - /// - /// A Disk. - /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DiskFragment disk, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IDisksOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -306,9 +224,6 @@ public static Disk Update(this IDisksOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -321,9 +236,9 @@ public static Disk Update(this IDisksOperations operations, string resourceGroup /// /// Properties of the disk to attach. /// - public static void Attach(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + public static void Attach(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) { - operations.AttachAsync(resourceGroupName, labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + operations.AttachAsync(labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); } /// @@ -333,9 +248,6 @@ public static void Attach(this IDisksOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -351,9 +263,9 @@ public static void Attach(this IDisksOperations operations, string resourceGroup /// /// The cancellation token. /// - public static async Task AttachAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AttachAsync(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.AttachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.AttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -363,9 +275,6 @@ public static void Attach(this IDisksOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -378,9 +287,9 @@ public static void Attach(this IDisksOperations operations, string resourceGroup /// /// Properties of the disk to detach. /// - public static void Detach(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + public static void Detach(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) { - operations.DetachAsync(resourceGroupName, labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + operations.DetachAsync(labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); } /// @@ -390,9 +299,6 @@ public static void Detach(this IDisksOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -408,9 +314,9 @@ public static void Detach(this IDisksOperations operations, string resourceGroup /// /// The cancellation token. /// - public static async Task DetachAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DetachAsync(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DetachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -420,9 +326,6 @@ public static void Detach(this IDisksOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -435,9 +338,9 @@ public static void Detach(this IDisksOperations operations, string resourceGroup /// /// A Disk. /// - public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, Disk disk) + public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string labName, string userName, string name, Disk disk) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, userName, name, disk).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(labName, userName, name, disk).GetAwaiter().GetResult(); } /// @@ -447,9 +350,6 @@ public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -465,9 +365,9 @@ public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IDisksOperations operations, string labName, string userName, string name, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -479,9 +379,6 @@ public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -491,9 +388,9 @@ public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string /// /// The name of the disk. /// - public static void BeginDelete(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name) + public static void BeginDelete(this IDisksOperations operations, string labName, string userName, string name) { - operations.BeginDeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(labName, userName, name).GetAwaiter().GetResult(); } /// @@ -502,9 +399,6 @@ public static void BeginDelete(this IDisksOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -517,9 +411,9 @@ public static void BeginDelete(this IDisksOperations operations, string resource /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IDisksOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -529,9 +423,6 @@ public static void BeginDelete(this IDisksOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -544,9 +435,9 @@ public static void BeginDelete(this IDisksOperations operations, string resource /// /// Properties of the disk to attach. /// - public static void BeginAttach(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + public static void BeginAttach(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) { - operations.BeginAttachAsync(resourceGroupName, labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + operations.BeginAttachAsync(labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); } /// @@ -556,9 +447,6 @@ public static void BeginAttach(this IDisksOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -574,9 +462,9 @@ public static void BeginAttach(this IDisksOperations operations, string resource /// /// The cancellation token. /// - public static async Task BeginAttachAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginAttachAsync(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginAttachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginAttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -586,9 +474,6 @@ public static void BeginAttach(this IDisksOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -601,9 +486,9 @@ public static void BeginAttach(this IDisksOperations operations, string resource /// /// Properties of the disk to detach. /// - public static void BeginDetach(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + public static void BeginDetach(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) { - operations.BeginDetachAsync(resourceGroupName, labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + operations.BeginDetachAsync(labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); } /// @@ -613,9 +498,6 @@ public static void BeginDetach(this IDisksOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -631,9 +513,9 @@ public static void BeginDetach(this IDisksOperations operations, string resource /// /// The cancellation token. /// - public static async Task BeginDetachAsync(this IDisksOperations operations, string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDetachAsync(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDetachWithHttpMessagesAsync(resourceGroupName, labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs index 3febf1fb06d9..1aad7b39f920 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs @@ -54,9 +54,6 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// List environments in a given user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -87,15 +84,15 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -117,7 +114,6 @@ internal EnvironmentsOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,7 +123,7 @@ internal EnvironmentsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); List _queryParameters = new List(); @@ -271,9 +267,6 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// Get environment. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -308,15 +301,15 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string userName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -341,7 +334,6 @@ internal EnvironmentsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -353,7 +345,7 @@ internal EnvironmentsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -495,9 +487,6 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// Create or replace an existing environment. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -516,19 +505,16 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, dtlEnvironment, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Delete environment. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -544,248 +530,17 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// Modify properties of environments. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// An environment, which is essentially an ARM template deployment. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string userName, string name, DtlEnvironmentFragment dtlEnvironment, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (dtlEnvironment == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dtlEnvironment"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - tracingParameters.Add("dtlEnvironment", dtlEnvironment); - 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.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(dtlEnvironment != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dtlEnvironment, 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); - } - System.Net.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 replace an existing environment. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -819,15 +574,15 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -856,7 +611,6 @@ internal EnvironmentsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -868,7 +622,7 @@ internal EnvironmentsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -1029,9 +783,6 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// Delete environment. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1059,15 +810,15 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1092,7 +843,6 @@ internal EnvironmentsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -1103,7 +853,7 @@ internal EnvironmentsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -1170,7 +920,7 @@ internal EnvironmentsOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs index 9869ea3e9494..ac5a514d6717 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs @@ -28,9 +28,6 @@ public static partial class EnvironmentsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -40,9 +37,9 @@ public static partial class EnvironmentsOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage List(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IEnvironmentsOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, userName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); } /// @@ -51,9 +48,6 @@ public static partial class EnvironmentsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -66,9 +60,9 @@ public static partial class EnvironmentsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IEnvironmentsOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -80,9 +74,6 @@ public static partial class EnvironmentsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -96,9 +87,9 @@ public static partial class EnvironmentsOperationsExtensions /// Specify the $expand query. Example: /// 'properties($select=deploymentProperties)' /// - public static DtlEnvironment Get(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string)) + public static DtlEnvironment Get(this IEnvironmentsOperations operations, string labName, string userName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, userName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); } /// @@ -107,9 +98,6 @@ public static partial class EnvironmentsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -126,9 +114,9 @@ public static partial class EnvironmentsOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -141,9 +129,6 @@ public static partial class EnvironmentsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -156,9 +141,9 @@ public static partial class EnvironmentsOperationsExtensions /// /// An environment, which is essentially an ARM template deployment. /// - public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment) + public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); } /// @@ -168,9 +153,6 @@ public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operati /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -186,9 +168,9 @@ public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operati /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -200,9 +182,6 @@ public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operati /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -212,9 +191,9 @@ public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operati /// /// The name of the environment. /// - public static void Delete(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name) + public static void Delete(this IEnvironmentsOperations operations, string labName, string userName, string name) { - operations.DeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); } /// @@ -223,61 +202,6 @@ public static void Delete(this IEnvironmentsOperations operations, string resour /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of environments. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// An environment, which is essentially an ARM template deployment. - /// - public static DtlEnvironment Update(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironmentFragment dtlEnvironment) - { - return operations.UpdateAsync(resourceGroupName, labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of environments. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -287,18 +211,12 @@ public static DtlEnvironment Update(this IEnvironmentsOperations operations, str /// /// The name of the environment. /// - /// - /// An environment, which is essentially an ARM template deployment. - /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironmentFragment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -308,9 +226,6 @@ public static DtlEnvironment Update(this IEnvironmentsOperations operations, str /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -323,9 +238,9 @@ public static DtlEnvironment Update(this IEnvironmentsOperations operations, str /// /// An environment, which is essentially an ARM template deployment. /// - public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment) + public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); } /// @@ -335,9 +250,6 @@ public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations op /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -353,9 +265,9 @@ public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations op /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -367,9 +279,6 @@ public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations op /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -379,9 +288,9 @@ public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations op /// /// The name of the environment. /// - public static void BeginDelete(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name) + public static void BeginDelete(this IEnvironmentsOperations operations, string labName, string userName, string name) { - operations.BeginDeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(labName, userName, name).GetAwaiter().GetResult(); } /// @@ -390,9 +299,6 @@ public static void BeginDelete(this IEnvironmentsOperations operations, string r /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -405,9 +311,9 @@ public static void BeginDelete(this IEnvironmentsOperations operations, string r /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs index 71ca5c312cf1..686196b0e236 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs @@ -54,9 +54,6 @@ internal FormulasOperations(DevTestLabsClient client) /// /// List formulas in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal FormulasOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal FormulasOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal FormulasOperations(DevTestLabsClient client) /// /// Get formula. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -295,15 +288,15 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -324,7 +317,6 @@ internal FormulasOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -335,7 +327,7 @@ internal FormulasOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -476,9 +468,6 @@ internal FormulasOperations(DevTestLabsClient client) /// Create or replace an existing Formula. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -494,19 +483,16 @@ internal FormulasOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, formula, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, formula, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Delete formula. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -531,15 +517,15 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -560,7 +546,6 @@ internal FormulasOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -570,7 +555,7 @@ internal FormulasOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -685,232 +670,10 @@ internal FormulasOperations(DevTestLabsClient client) return _result; } - /// - /// Modify properties of formulas. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// A formula for creating a VM, specifying an image base and other parameters - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string name, FormulaFragment formula, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (formula == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "formula"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("formula", formula); - 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.DevTestLab/labs/{labName}/formulas/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(formula != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(formula, 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); - } - System.Net.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 replace an existing Formula. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -941,15 +704,15 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -974,7 +737,6 @@ internal FormulasOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("formula", formula); @@ -985,7 +747,7 @@ internal FormulasOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs index ff69f07d4986..91254b87a009 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class FormulasOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this IFormulasOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IFormulasOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class FormulasOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class FormulasOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IFormulasOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IFormulasOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,9 +68,6 @@ public static partial class FormulasOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,9 +77,9 @@ public static partial class FormulasOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=description)' /// - public static Formula Get(this IFormulasOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static Formula Get(this IFormulasOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -97,9 +88,6 @@ public static partial class FormulasOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -112,9 +100,9 @@ public static partial class FormulasOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IFormulasOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -127,9 +115,6 @@ public static partial class FormulasOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -139,9 +124,9 @@ public static partial class FormulasOperationsExtensions /// /// A formula for creating a VM, specifying an image base and other parameters /// - public static Formula CreateOrUpdate(this IFormulasOperations operations, string resourceGroupName, string labName, string name, Formula formula) + public static Formula CreateOrUpdate(this IFormulasOperations operations, string labName, string name, Formula formula) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, formula).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, formula).GetAwaiter().GetResult(); } /// @@ -151,9 +136,6 @@ public static Formula CreateOrUpdate(this IFormulasOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -166,9 +148,9 @@ public static Formula CreateOrUpdate(this IFormulasOperations operations, string /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, Formula formula, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IFormulasOperations operations, string labName, string name, Formula formula, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, formula, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, formula, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -180,18 +162,15 @@ public static Formula CreateOrUpdate(this IFormulasOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the formula. /// - public static void Delete(this IFormulasOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this IFormulasOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -200,73 +179,18 @@ public static void Delete(this IFormulasOperations operations, string resourceGr /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of formulas. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// A formula for creating a VM, specifying an image base and other parameters - /// - public static Formula Update(this IFormulasOperations operations, string resourceGroupName, string labName, string name, FormulaFragment formula) - { - return operations.UpdateAsync(resourceGroupName, labName, name, formula).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of formulas. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the formula. /// - /// - /// A formula for creating a VM, specifying an image base and other parameters - /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, FormulaFragment formula, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IFormulasOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, formula, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -276,9 +200,6 @@ public static Formula Update(this IFormulasOperations operations, string resourc /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -288,9 +209,9 @@ public static Formula Update(this IFormulasOperations operations, string resourc /// /// A formula for creating a VM, specifying an image base and other parameters /// - public static Formula BeginCreateOrUpdate(this IFormulasOperations operations, string resourceGroupName, string labName, string name, Formula formula) + public static Formula BeginCreateOrUpdate(this IFormulasOperations operations, string labName, string name, Formula formula) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, formula).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(labName, name, formula).GetAwaiter().GetResult(); } /// @@ -300,9 +221,6 @@ public static Formula BeginCreateOrUpdate(this IFormulasOperations operations, s /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -315,9 +233,9 @@ public static Formula BeginCreateOrUpdate(this IFormulasOperations operations, s /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IFormulasOperations operations, string resourceGroupName, string labName, string name, Formula formula, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IFormulasOperations operations, string labName, string name, Formula formula, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, formula, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, formula, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs index 3f528983dcb4..66ab6eaeeed4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs @@ -54,9 +54,6 @@ internal GalleryImagesOperations(DevTestLabsClient client) /// /// List gallery images in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal GalleryImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal GalleryImagesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal GalleryImagesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs index 85502f30dd75..73dbcbe417f0 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class GalleryImagesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this IGalleryImagesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IGalleryImagesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class GalleryImagesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class GalleryImagesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IGalleryImagesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IGalleryImagesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs index 809227bb70c6..80e2810b90a6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs @@ -244,9 +244,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// List schedules in a resource group. /// - /// - /// The name of the resource group. - /// /// /// OData parameters to apply to the operation. /// @@ -271,15 +268,15 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (Client.ApiVersion == null) { @@ -293,7 +290,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -301,7 +297,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); List _queryParameters = new List(); if (odataQuery != null) { @@ -443,9 +439,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// Get schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -473,15 +466,15 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -498,7 +491,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); @@ -508,7 +500,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (expand != null) @@ -647,9 +639,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// Create or replace an existing schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -677,15 +666,15 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -706,7 +695,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("schedule", schedule); tracingParameters.Add("cancellationToken", cancellationToken); @@ -716,7 +704,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -875,9 +863,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// Delete schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -899,15 +884,15 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -924,7 +909,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); @@ -933,7 +917,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1050,9 +1034,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// Modify properties of schedules. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -1080,15 +1061,15 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -1109,7 +1090,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("schedule", schedule); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1119,7 +1099,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1260,9 +1240,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -1272,10 +1249,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(resourceGroupName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -1283,9 +1260,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// Updates a schedule's target resource Id. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -1298,19 +1272,16 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task RetargetWithHttpMessagesAsync(string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginRetargetWithHttpMessagesAsync(resourceGroupName, name, retargetScheduleProperties, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginRetargetWithHttpMessagesAsync(name, retargetScheduleProperties, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -1332,15 +1303,15 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginExecuteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -1357,7 +1328,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); @@ -1366,7 +1336,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1484,9 +1454,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// Updates a schedule's target resource Id. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -1511,15 +1478,15 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRetargetWithHttpMessagesAsync(string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -1540,7 +1507,6 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("retargetScheduleProperties", retargetScheduleProperties); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1550,7 +1516,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs index 789917f7b6dd..261d7ec5590b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs @@ -62,15 +62,12 @@ public static partial class GlobalSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// OData parameters to apply to the operation. /// - public static IPage ListByResourceGroup(this IGlobalSchedulesOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage ListByResourceGroup(this IGlobalSchedulesOperations operations, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListByResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); + return operations.ListByResourceGroupAsync(odataQuery).GetAwaiter().GetResult(); } /// @@ -79,18 +76,15 @@ public static partial class GlobalSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// OData parameters to apply to the operation. /// /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IGlobalSchedulesOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -102,18 +96,15 @@ public static partial class GlobalSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// /// /// Specify the $expand query. Example: 'properties($select=status)' /// - public static Schedule Get(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, string expand = default(string)) + public static Schedule Get(this IGlobalSchedulesOperations operations, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(name, expand).GetAwaiter().GetResult(); } /// @@ -122,9 +113,6 @@ public static partial class GlobalSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -134,9 +122,9 @@ public static partial class GlobalSchedulesOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IGlobalSchedulesOperations operations, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -148,18 +136,15 @@ public static partial class GlobalSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// /// /// A schedule. /// - public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, Schedule schedule) + public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations, string name, Schedule schedule) { - return operations.CreateOrUpdateAsync(resourceGroupName, name, schedule).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(name, schedule).GetAwaiter().GetResult(); } /// @@ -168,9 +153,6 @@ public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -180,9 +162,9 @@ public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IGlobalSchedulesOperations operations, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, schedule, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -194,15 +176,12 @@ public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// - public static void Delete(this IGlobalSchedulesOperations operations, string resourceGroupName, string name) + public static void Delete(this IGlobalSchedulesOperations operations, string name) { - operations.DeleteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(name).GetAwaiter().GetResult(); } /// @@ -211,18 +190,15 @@ public static void Delete(this IGlobalSchedulesOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IGlobalSchedulesOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -231,18 +207,15 @@ public static void Delete(this IGlobalSchedulesOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// /// /// A schedule. /// - public static Schedule Update(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, ScheduleFragment schedule) + public static Schedule Update(this IGlobalSchedulesOperations operations, string name, ScheduleFragment schedule) { - return operations.UpdateAsync(resourceGroupName, name, schedule).GetAwaiter().GetResult(); + return operations.UpdateAsync(name, schedule).GetAwaiter().GetResult(); } /// @@ -251,9 +224,6 @@ public static Schedule Update(this IGlobalSchedulesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -263,9 +233,9 @@ public static Schedule Update(this IGlobalSchedulesOperations operations, string /// /// The cancellation token. /// - public static async Task UpdateAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IGlobalSchedulesOperations operations, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(name, schedule, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -277,15 +247,12 @@ public static Schedule Update(this IGlobalSchedulesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// - public static void Execute(this IGlobalSchedulesOperations operations, string resourceGroupName, string name) + public static void Execute(this IGlobalSchedulesOperations operations, string name) { - operations.ExecuteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + operations.ExecuteAsync(name).GetAwaiter().GetResult(); } /// @@ -294,18 +261,15 @@ public static void Execute(this IGlobalSchedulesOperations operations, string re /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// /// /// The cancellation token. /// - public static async Task ExecuteAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExecuteAsync(this IGlobalSchedulesOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ExecuteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -315,18 +279,15 @@ public static void Execute(this IGlobalSchedulesOperations operations, string re /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// /// /// Properties for retargeting a virtual machine schedule. /// - public static void Retarget(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties) + public static void Retarget(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties) { - operations.RetargetAsync(resourceGroupName, name, retargetScheduleProperties).GetAwaiter().GetResult(); + operations.RetargetAsync(name, retargetScheduleProperties).GetAwaiter().GetResult(); } /// @@ -336,9 +297,6 @@ public static void Retarget(this IGlobalSchedulesOperations operations, string r /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -348,9 +306,9 @@ public static void Retarget(this IGlobalSchedulesOperations operations, string r /// /// The cancellation token. /// - public static async Task RetargetAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RetargetAsync(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.RetargetWithHttpMessagesAsync(resourceGroupName, name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.RetargetWithHttpMessagesAsync(name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -359,15 +317,12 @@ public static void Retarget(this IGlobalSchedulesOperations operations, string r /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// - public static void BeginExecute(this IGlobalSchedulesOperations operations, string resourceGroupName, string name) + public static void BeginExecute(this IGlobalSchedulesOperations operations, string name) { - operations.BeginExecuteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + operations.BeginExecuteAsync(name).GetAwaiter().GetResult(); } /// @@ -376,18 +331,15 @@ public static void BeginExecute(this IGlobalSchedulesOperations operations, stri /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// /// /// The cancellation token. /// - public static async Task BeginExecuteAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginExecuteAsync(this IGlobalSchedulesOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginExecuteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -397,18 +349,15 @@ public static void BeginExecute(this IGlobalSchedulesOperations operations, stri /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// /// /// Properties for retargeting a virtual machine schedule. /// - public static void BeginRetarget(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties) + public static void BeginRetarget(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties) { - operations.BeginRetargetAsync(resourceGroupName, name, retargetScheduleProperties).GetAwaiter().GetResult(); + operations.BeginRetargetAsync(name, retargetScheduleProperties).GetAwaiter().GetResult(); } /// @@ -418,9 +367,6 @@ public static void BeginRetarget(this IGlobalSchedulesOperations operations, str /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -430,9 +376,9 @@ public static void BeginRetarget(this IGlobalSchedulesOperations operations, str /// /// The cancellation token. /// - public static async Task BeginRetargetAsync(this IGlobalSchedulesOperations operations, string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginRetargetAsync(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginRetargetWithHttpMessagesAsync(resourceGroupName, name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginRetargetWithHttpMessagesAsync(name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs index 824bc0c14050..eb3ccba681f2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs @@ -27,9 +27,6 @@ public partial interface IArmTemplatesOperations /// /// List azure resource manager templates in a given artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -54,13 +51,10 @@ public partial interface IArmTemplatesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get azure resource manager template. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -89,7 +83,7 @@ public partial interface IArmTemplatesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List azure resource manager templates in a given artifact source. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs index 466cb9703b0f..0a9f812ea6ef 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs @@ -27,9 +27,6 @@ public partial interface IArtifactSourcesOperations /// /// List artifact sources in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -83,13 +77,10 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -114,13 +105,10 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ArtifactSource artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ArtifactSource artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -139,13 +127,10 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of artifact sources. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -170,7 +155,7 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ArtifactSourceFragment artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string labName, string name, ArtifactSourceFragment artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List artifact sources in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs index c32e03633389..4f0966887c54 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs @@ -27,9 +27,6 @@ public partial interface IArtifactsOperations /// /// List artifacts in a given artifact source. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -54,13 +51,10 @@ public partial interface IArtifactsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get artifact. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -88,15 +82,12 @@ public partial interface IArtifactsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Generates an ARM template for the given artifact, uploads the /// required files to a storage account, and validates the generated /// artifact. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -124,7 +115,7 @@ public partial interface IArtifactsOperations /// /// Thrown when a required parameter is null /// - Task> GenerateArmTemplateWithHttpMessagesAsync(string resourceGroupName, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GenerateArmTemplateWithHttpMessagesAsync(string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List artifacts in a given artifact source. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs index ba5361f47180..322320d5d4c2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs @@ -26,9 +26,6 @@ public partial interface ICostsOperations /// /// Get cost. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -54,13 +51,10 @@ public partial interface ICostsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing cost. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -85,6 +79,6 @@ public partial interface ICostsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabCost labCost, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabCost labCost, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs index fb56f74f7a86..621ee9e7fe7a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs @@ -27,9 +27,6 @@ public partial interface ICustomImagesOperations /// /// List custom images in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface ICustomImagesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get custom image. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -82,14 +76,11 @@ public partial interface ICustomImagesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing custom image. This operation can take /// a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -114,13 +105,10 @@ public partial interface ICustomImagesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete custom image. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -139,45 +127,11 @@ public partial interface ICustomImagesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of custom images. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// A custom image. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string name, CustomImageFragment customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing custom image. This operation can take /// a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -202,13 +156,10 @@ public partial interface ICustomImagesOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete custom image. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -227,7 +178,7 @@ public partial interface ICustomImagesOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List custom images in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs index ae1ff0889dc8..4d0c6b6f5cd4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs @@ -45,6 +45,11 @@ public partial interface IDevTestLabsClient : System.IDisposable /// string ApiVersion { get; } + /// + /// The name of the resource group. + /// + string ResourceGroupName { get; set; } + /// /// The subscription ID. /// @@ -169,16 +174,6 @@ public partial interface IDevTestLabsClient : System.IDisposable /// ISecretsOperations Secrets { get; } - /// - /// Gets the IServiceFabricsOperations. - /// - IServiceFabricsOperations ServiceFabrics { get; } - - /// - /// Gets the IServiceFabricSchedulesOperations. - /// - IServiceFabricSchedulesOperations ServiceFabricSchedules { get; } - /// /// Gets the IVirtualMachinesOperations. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs index 52f70aa1a237..f9b433fa50dc 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs @@ -27,9 +27,6 @@ public partial interface IDisksOperations /// /// List disks in a given user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -54,13 +51,10 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get disk. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -88,14 +82,11 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing disk. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -123,41 +114,10 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete disk. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of disks. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -167,9 +127,6 @@ public partial interface IDisksOperations /// /// The name of the disk. /// - /// - /// A Disk. - /// /// /// The headers that will be added to request. /// @@ -179,20 +136,14 @@ public partial interface IDisksOperations /// /// 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 labName, string userName, string name, DiskFragment disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Attach and create the lease of the disk to the virtual machine. /// This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -217,14 +168,11 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task AttachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task AttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Detach and break the lease of the disk attached to the virtual /// machine. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -249,14 +197,11 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task DetachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing disk. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -284,13 +229,10 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete disk. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -312,14 +254,11 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Attach and create the lease of the disk to the virtual machine. /// This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -344,14 +283,11 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task BeginAttachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginAttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Detach and break the lease of the disk attached to the virtual /// machine. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -376,7 +312,7 @@ public partial interface IDisksOperations /// /// Thrown when a required parameter is null /// - Task BeginDetachWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List disks in a given user profile. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs index 28d2384aa0bb..ab482be08e9a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs @@ -27,9 +27,6 @@ public partial interface IEnvironmentsOperations /// /// List environments in a given user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -54,13 +51,10 @@ public partial interface IEnvironmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get environment. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -89,14 +83,11 @@ public partial interface IEnvironmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing environment. This operation can take /// a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -124,41 +115,10 @@ public partial interface IEnvironmentsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete environment. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of environments. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -168,9 +128,6 @@ public partial interface IEnvironmentsOperations /// /// The name of the environment. /// - /// - /// An environment, which is essentially an ARM template deployment. - /// /// /// The headers that will be added to request. /// @@ -180,20 +137,14 @@ public partial interface IEnvironmentsOperations /// /// 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 labName, string userName, string name, DtlEnvironmentFragment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing environment. This operation can take /// a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -221,13 +172,10 @@ public partial interface IEnvironmentsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete environment. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -249,7 +197,7 @@ public partial interface IEnvironmentsOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List environments in a given user profile. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs index 48864015c4dd..f24793a8023e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs @@ -27,9 +27,6 @@ public partial interface IFormulasOperations /// /// List formulas in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface IFormulasOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get formula. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -83,14 +77,11 @@ public partial interface IFormulasOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing Formula. This operation can take a /// while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -116,13 +107,10 @@ public partial interface IFormulasOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete formula. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -141,46 +129,11 @@ public partial interface IFormulasOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of formulas. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// A formula for creating a VM, specifying an image base and other - /// parameters - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string name, FormulaFragment formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing Formula. This operation can take a /// while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -206,7 +159,7 @@ public partial interface IFormulasOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List formulas in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs index aaf883380f59..ca0b026cc549 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs @@ -27,9 +27,6 @@ public partial interface IGalleryImagesOperations /// /// List gallery images in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,7 +48,7 @@ public partial interface IGalleryImagesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List gallery images in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs index dd2c73fc409b..5158647efdf3 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs @@ -49,9 +49,6 @@ public partial interface IGlobalSchedulesOperations /// /// List schedules in a resource group. /// - /// - /// The name of the resource group. - /// /// /// OData parameters to apply to the operation. /// @@ -70,13 +67,10 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -98,13 +92,10 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -126,13 +117,10 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -148,13 +136,10 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of schedules. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -176,13 +161,10 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -198,14 +180,11 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ExecuteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates a schedule's target resource Id. This operation can take a /// while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -224,13 +203,10 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task RetargetWithHttpMessagesAsync(string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -246,14 +222,11 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginExecuteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates a schedule's target resource Id. This operation can take a /// while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the schedule. /// @@ -272,7 +245,7 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when a required parameter is null /// - Task BeginRetargetWithHttpMessagesAsync(string resourceGroupName, string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginRetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List schedules in a subscription. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs index 5caa37c63a5e..0001041d5898 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs @@ -49,9 +49,6 @@ public partial interface ILabsOperations /// /// List labs in a resource group. /// - /// - /// The name of the resource group. - /// /// /// OData parameters to apply to the operation. /// @@ -70,13 +67,10 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -99,14 +93,11 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing lab. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -128,13 +119,10 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete lab. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -150,13 +138,10 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of labs. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -178,14 +163,11 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string name, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string name, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Claim a random claimable virtual machine in the lab. This operation /// can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -201,14 +183,11 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task ClaimAnyVmWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ClaimAnyVmWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create virtual machines in a lab. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -227,14 +206,11 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task CreateEnvironmentWithHttpMessagesAsync(string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task CreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Exports the lab resource usage into a storage account This /// operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -253,13 +229,10 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task ExportResourceUsageWithHttpMessagesAsync(string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Generate a URI for uploading custom disk images to a Lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -281,40 +254,10 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task> GenerateUploadUriWithHttpMessagesAsync(string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Import a virtual machine into a different lab. This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// This represents the payload required to import a virtual machine - /// from a different lab into the current one - /// - /// - /// 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 ImportVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GenerateUploadUriWithHttpMessagesAsync(string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List disk images available for custom image creation. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -333,14 +276,11 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task>> ListVhdsWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListVhdsWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing lab. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -362,13 +302,10 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete lab. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -384,14 +321,11 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Claim a random claimable virtual machine in the lab. This operation /// can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -407,14 +341,11 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task BeginClaimAnyVmWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginClaimAnyVmWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create virtual machines in a lab. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -433,14 +364,11 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task BeginCreateEnvironmentWithHttpMessagesAsync(string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginCreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Exports the lab resource usage into a storage account This /// operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -459,34 +387,7 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task BeginExportResourceUsageWithHttpMessagesAsync(string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Import a virtual machine into a different lab. This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// This represents the payload required to import a virtual machine - /// from a different lab into the current one - /// - /// - /// 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 BeginImportVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List labs in a subscription. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs index b4b8dc3d17de..d3f90e86c2b9 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs @@ -27,9 +27,6 @@ public partial interface INotificationChannelsOperations /// /// List notificationchannels in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface INotificationChannelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get notificationchannel. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -83,13 +77,10 @@ public partial interface INotificationChannelsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing notificationChannel. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -114,13 +105,10 @@ public partial interface INotificationChannelsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, NotificationChannel notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, NotificationChannel notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete notificationchannel. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -139,13 +127,10 @@ public partial interface INotificationChannelsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of notificationchannels. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -170,13 +155,10 @@ public partial interface INotificationChannelsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, NotificationChannelFragment notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string labName, string name, NotificationChannelFragment notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send notification to provided channel. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -198,7 +180,7 @@ public partial interface INotificationChannelsOperations /// /// Thrown when a required parameter is null /// - Task NotifyWithHttpMessagesAsync(string resourceGroupName, string labName, string name, NotifyParameters notifyParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task NotifyWithHttpMessagesAsync(string labName, string name, NotifyParameters notifyParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List notificationchannels in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs index 49cc0746565d..f9ceb68a1ec4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs @@ -27,9 +27,6 @@ public partial interface IPoliciesOperations /// /// List policies in a given policy set. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -54,13 +51,10 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get policy. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -89,13 +83,10 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string policySetName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing policy. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -123,13 +114,10 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, string name, Policy policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string policySetName, string name, Policy policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete policy. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -151,13 +139,10 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string policySetName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of policies. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -185,7 +170,7 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, string name, PolicyFragment policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string labName, string policySetName, string name, PolicyFragment policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List policies in a given policy set. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs index 2edc6e6b823b..0fd643c2f1ad 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs @@ -26,9 +26,6 @@ public partial interface IPolicySetsOperations /// /// Evaluates lab policy. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -53,6 +50,6 @@ public partial interface IPolicySetsOperations /// /// Thrown when a required parameter is null /// - Task> EvaluatePoliciesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> EvaluatePoliciesWithHttpMessagesAsync(string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs index 00111fe801a7..5f51eaedec39 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs @@ -27,9 +27,6 @@ public partial interface ISchedulesOperations /// /// List schedules in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface ISchedulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -82,13 +76,10 @@ public partial interface ISchedulesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -113,13 +104,10 @@ public partial interface ISchedulesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -138,13 +126,10 @@ public partial interface ISchedulesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of schedules. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -169,13 +154,10 @@ public partial interface ISchedulesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string labName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -194,13 +176,10 @@ public partial interface ISchedulesOperations /// /// Thrown when a required parameter is null /// - Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ExecuteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all applicable schedules /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -222,13 +201,10 @@ public partial interface ISchedulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListApplicableWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListApplicableWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -247,7 +223,7 @@ public partial interface ISchedulesOperations /// /// Thrown when a required parameter is null /// - Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginExecuteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List schedules in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs index ca5de78577c7..9437c29de280 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs @@ -27,9 +27,6 @@ public partial interface ISecretsOperations /// /// List secrets in a given user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -54,13 +51,10 @@ public partial interface ISecretsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get secret. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -88,14 +82,10 @@ public partial interface ISecretsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or replace an existing secret. This operation can take a - /// while to complete. + /// Create or replace an existing secret. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -123,76 +113,10 @@ public partial interface ISecretsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete secret. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of secrets. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// A secret. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string userName, string name, SecretFragment secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing secret. This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -202,9 +126,6 @@ public partial interface ISecretsOperations /// /// The name of the secret. /// - /// - /// A secret. - /// /// /// The headers that will be added to request. /// @@ -214,13 +135,10 @@ public partial interface ISecretsOperations /// /// 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 labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List secrets in a given user profile. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricSchedulesOperations.cs deleted file mode 100644 index 9f3da080eeca..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricSchedulesOperations.cs +++ /dev/null @@ -1,288 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs -{ - 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; - - /// - /// ServiceFabricSchedulesOperations operations. - /// - public partial interface IServiceFabricSchedulesOperations - { - /// - /// List schedules in a given service fabric. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get schedule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string userName, string serviceFabricName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing schedule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string userName, string serviceFabricName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete schedule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// 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 labName, string userName, string serviceFabricName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of schedules. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string userName, string serviceFabricName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// 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 ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List schedules in a given service fabric. - /// - /// - /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricsOperations.cs deleted file mode 100644 index 01b54afaa2d9..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceFabricsOperations.cs +++ /dev/null @@ -1,421 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs -{ - 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; - - /// - /// ServiceFabricsOperations operations. - /// - public partial interface IServiceFabricsOperations - { - /// - /// List service fabrics in a given user profile. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get service fabric. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($expand=applicableSchedule)' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing Service Fabric. This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string userName, string name, ServiceFabric serviceFabric, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete service fabric. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of service fabrics. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string userName, string name, ServiceFabricFragment serviceFabric, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists the applicable start/stop schedules, if any. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Start a service fabric. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Stop a service fabric This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 StopWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing Service Fabric. This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string userName, string name, ServiceFabric serviceFabric, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete service fabric. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Start a service fabric. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Stop a service fabric This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List service fabrics in a given user profile. - /// - /// - /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs index c05412a2c44d..6b629dd20228 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs @@ -27,9 +27,6 @@ public partial interface IServiceRunnersOperations /// /// List service runners in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface IServiceRunnersOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get service runner. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -79,13 +73,10 @@ public partial interface IServiceRunnersOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing Service runner. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -110,13 +101,10 @@ public partial interface IServiceRunnersOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ServiceRunner serviceRunner, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ServiceRunner serviceRunner, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete service runner. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -135,7 +123,7 @@ public partial interface IServiceRunnersOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List service runners in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs index 376f9a3b7e26..e8c07bf7c643 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs @@ -27,9 +27,6 @@ public partial interface IUsersOperations /// /// List user profiles in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -82,14 +76,10 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or replace an existing user profile. This operation can take - /// a while to complete. + /// Create or replace an existing user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -114,13 +104,10 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete user profile. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -139,13 +126,10 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of user profiles. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -170,45 +154,10 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing user profile. This operation can take - /// a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Profile of a lab user. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// 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 labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string labName, string name, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete user profile. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -227,7 +176,7 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List user profiles in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs index 8976e2e36d0b..52b4c4e86c9e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs @@ -27,9 +27,6 @@ public partial interface IVirtualMachineSchedulesOperations /// /// List schedules in a given virtual machine. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -54,13 +51,10 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -88,13 +82,10 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string virtualMachineName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -122,13 +113,10 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -150,13 +138,10 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of schedules. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -184,13 +169,10 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -212,13 +194,10 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when a required parameter is null /// - Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -240,7 +219,7 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when a required parameter is null /// - Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List schedules in a given virtual machine. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs index 495a0cbcbbe6..5c3fa2f6c251 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs @@ -27,9 +27,6 @@ public partial interface IVirtualMachinesOperations /// /// List virtual machines in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get virtual machine. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -83,14 +77,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing Virtual machine. This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -115,14 +106,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete virtual machine. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -141,13 +129,10 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of virtual machines. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -172,14 +157,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachineFragment labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Attach a new or existing data disk to virtual machine. This /// operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -202,14 +184,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task AddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task AddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Apply artifacts to virtual machine. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -231,14 +210,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Take ownership of an existing virtual machine This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -257,14 +233,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task ClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ClaimWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Detach the specified disk from the virtual machine. This operation /// can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -286,42 +259,10 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task DetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a string that represents the contents of the RDP file for the - /// virtual machine - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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> GetRdpFileContentsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists the applicable start/stop schedules, if any. + /// Lists all applicable schedules /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -343,95 +284,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Redeploy a virtual machine This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Resize Virtual Machine. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for resizing a 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 ResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Restart a virtual machine. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListApplicableSchedulesWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Start a virtual machine. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -450,66 +307,10 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task StartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task StartWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Stop a virtual machine This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 StopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Transfers all data disks attached to the virtual machine to be - /// owned by the current user. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 TransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Release ownership of an existing virtual machine This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -528,14 +329,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task UnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task StopWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing Virtual machine. This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -560,14 +358,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete virtual machine. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -586,14 +381,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Attach a new or existing data disk to virtual machine. This /// operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -616,14 +408,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task BeginAddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginAddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Apply artifacts to virtual machine. This operation can take a while /// to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -645,14 +434,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Take ownership of an existing virtual machine This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -671,14 +457,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task BeginClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginClaimWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Detach the specified disk from the virtual machine. This operation /// can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -700,95 +483,11 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task BeginDetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Redeploy a virtual machine This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Resize Virtual Machine. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for resizing a 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 BeginResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Restart a virtual machine. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Start a virtual machine. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -807,66 +506,10 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginStartWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Stop a virtual machine This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Transfers all data disks attached to the virtual machine to be - /// owned by the current user. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 BeginTransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Release ownership of an existing virtual machine This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -885,7 +528,7 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task BeginUnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginStopWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List virtual machines in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs index 8a24a0dd1996..aee7a53a1bbe 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs @@ -27,9 +27,6 @@ public partial interface IVirtualNetworksOperations /// /// List virtual networks in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -51,13 +48,10 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get virtual network. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -83,14 +77,11 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing virtual network. This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -115,14 +106,11 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete virtual network. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -141,13 +129,10 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Modify properties of virtual networks. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -172,14 +157,11 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, VirtualNetworkFragment virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string labName, string name, VirtualNetworkFragment virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or replace an existing virtual network. This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -204,14 +186,11 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete virtual network. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -230,7 +209,7 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List virtual networks in a given lab. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs index 6eae66d5ed00..32fe146c0bad 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs @@ -244,9 +244,6 @@ internal LabsOperations(DevTestLabsClient client) /// /// List labs in a resource group. /// - /// - /// The name of the resource group. - /// /// /// OData parameters to apply to the operation. /// @@ -271,15 +268,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (Client.ApiVersion == null) { @@ -293,7 +290,6 @@ internal LabsOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -301,7 +297,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); List _queryParameters = new List(); if (odataQuery != null) { @@ -443,9 +439,6 @@ internal LabsOperations(DevTestLabsClient client) /// /// Get lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -474,15 +467,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -499,7 +492,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); @@ -509,7 +501,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (expand != null) @@ -649,9 +641,6 @@ internal LabsOperations(DevTestLabsClient client) /// Create or replace an existing lab. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -664,19 +653,16 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, lab, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(name, lab, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Delete lab. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -686,19 +672,16 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Modify properties of labs. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -726,15 +709,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string name, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string name, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -755,7 +738,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("lab", lab); tracingParameters.Add("cancellationToken", cancellationToken); @@ -765,7 +747,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -907,9 +889,6 @@ internal LabsOperations(DevTestLabsClient client) /// Claim a random claimable virtual machine in the lab. This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -919,10 +898,10 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task ClaimAnyVmWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ClaimAnyVmWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginClaimAnyVmWithHttpMessagesAsync(resourceGroupName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginClaimAnyVmWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -930,9 +909,6 @@ internal LabsOperations(DevTestLabsClient client) /// Create virtual machines in a lab. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -945,10 +921,10 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task CreateEnvironmentWithHttpMessagesAsync(string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task CreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginCreateEnvironmentWithHttpMessagesAsync(resourceGroupName, name, labVirtualMachineCreationParameter, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -956,9 +932,6 @@ internal LabsOperations(DevTestLabsClient client) /// Exports the lab resource usage into a storage account This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -971,19 +944,16 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task ExportResourceUsageWithHttpMessagesAsync(string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginExportResourceUsageWithHttpMessagesAsync(resourceGroupName, name, exportResourceUsageParameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Generate a URI for uploading custom disk images to a Lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1011,15 +981,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GenerateUploadUriWithHttpMessagesAsync(string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GenerateUploadUriWithHttpMessagesAsync(string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -1040,7 +1010,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("generateUploadUriParameter", generateUploadUriParameter); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1050,7 +1019,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1188,39 +1157,9 @@ internal LabsOperations(DevTestLabsClient client) return _result; } - /// - /// Import a virtual machine into a different lab. This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// This represents the payload required to import a virtual machine from a - /// different lab into the current one - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task ImportVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginImportVirtualMachineWithHttpMessagesAsync(resourceGroupName, name, importLabVirtualMachineRequest, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// List disk images available for custom image creation. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1245,15 +1184,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListVhdsWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListVhdsWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -1270,7 +1209,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListVhds", tracingParameters); @@ -1279,7 +1217,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1415,9 +1353,6 @@ internal LabsOperations(DevTestLabsClient client) /// Create or replace an existing lab. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1445,15 +1380,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -1474,7 +1409,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("lab", lab); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1484,7 +1418,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1643,9 +1577,6 @@ internal LabsOperations(DevTestLabsClient client) /// /// Delete lab. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1667,15 +1598,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -1692,7 +1623,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); @@ -1701,7 +1631,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1766,7 +1696,7 @@ internal LabsOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1819,9 +1749,6 @@ internal LabsOperations(DevTestLabsClient client) /// Claim a random claimable virtual machine in the lab. This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1843,15 +1770,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginClaimAnyVmWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginClaimAnyVmWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -1868,7 +1795,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginClaimAnyVm", tracingParameters); @@ -1877,7 +1803,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1995,9 +1921,6 @@ internal LabsOperations(DevTestLabsClient client) /// Create virtual machines in a lab. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -2022,15 +1945,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginCreateEnvironmentWithHttpMessagesAsync(string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginCreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -2051,7 +1974,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("labVirtualMachineCreationParameter", labVirtualMachineCreationParameter); tracingParameters.Add("cancellationToken", cancellationToken); @@ -2061,7 +1983,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -2185,9 +2107,6 @@ internal LabsOperations(DevTestLabsClient client) /// Exports the lab resource usage into a storage account This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -2212,15 +2131,15 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginExportResourceUsageWithHttpMessagesAsync(string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (name == null) { @@ -2241,7 +2160,6 @@ internal LabsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); tracingParameters.Add("exportResourceUsageParameters", exportResourceUsageParameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -2251,7 +2169,7 @@ internal LabsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -2371,197 +2289,6 @@ internal LabsOperations(DevTestLabsClient client) return _result; } - /// - /// Import a virtual machine into a different lab. This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// This represents the payload required to import a virtual machine from a - /// different lab into the current one - /// - /// - /// 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 BeginImportVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, 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 (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (importLabVirtualMachineRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "importLabVirtualMachineRequest"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("name", name); - tracingParameters.Add("importLabVirtualMachineRequest", importLabVirtualMachineRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginImportVirtualMachine", 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.DevTestLab/labs/{name}/importVirtualMachine").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(importLabVirtualMachineRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(importLabVirtualMachineRequest, 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); - } - System.Net.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; - } - /// /// List labs in a subscription. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs index b3a79f39d9f2..533204a16518 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs @@ -62,15 +62,12 @@ public static partial class LabsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// OData parameters to apply to the operation. /// - public static IPage ListByResourceGroup(this ILabsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage ListByResourceGroup(this ILabsOperations operations, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListByResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); + return operations.ListByResourceGroupAsync(odataQuery).GetAwaiter().GetResult(); } /// @@ -79,18 +76,15 @@ public static partial class LabsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// OData parameters to apply to the operation. /// /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this ILabsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this ILabsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -102,9 +96,6 @@ public static partial class LabsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -112,9 +103,9 @@ public static partial class LabsOperationsExtensions /// Specify the $expand query. Example: /// 'properties($select=defaultStorageAccount)' /// - public static Lab Get(this ILabsOperations operations, string resourceGroupName, string name, string expand = default(string)) + public static Lab Get(this ILabsOperations operations, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(name, expand).GetAwaiter().GetResult(); } /// @@ -123,9 +114,6 @@ public static partial class LabsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -136,9 +124,9 @@ public static partial class LabsOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this ILabsOperations operations, string resourceGroupName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ILabsOperations operations, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -151,18 +139,15 @@ public static partial class LabsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// A lab. /// - public static Lab CreateOrUpdate(this ILabsOperations operations, string resourceGroupName, string name, Lab lab) + public static Lab CreateOrUpdate(this ILabsOperations operations, string name, Lab lab) { - return operations.CreateOrUpdateAsync(resourceGroupName, name, lab).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(name, lab).GetAwaiter().GetResult(); } /// @@ -172,9 +157,6 @@ public static Lab CreateOrUpdate(this ILabsOperations operations, string resourc /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -184,9 +166,9 @@ public static Lab CreateOrUpdate(this ILabsOperations operations, string resourc /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ILabsOperations operations, string resourceGroupName, string name, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ILabsOperations operations, string name, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, lab, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -198,15 +180,12 @@ public static Lab CreateOrUpdate(this ILabsOperations operations, string resourc /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// - public static void Delete(this ILabsOperations operations, string resourceGroupName, string name) + public static void Delete(this ILabsOperations operations, string name) { - operations.DeleteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(name).GetAwaiter().GetResult(); } /// @@ -215,18 +194,15 @@ public static void Delete(this ILabsOperations operations, string resourceGroupN /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -235,18 +211,15 @@ public static void Delete(this ILabsOperations operations, string resourceGroupN /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// A lab. /// - public static Lab Update(this ILabsOperations operations, string resourceGroupName, string name, LabFragment lab) + public static Lab Update(this ILabsOperations operations, string name, LabFragment lab) { - return operations.UpdateAsync(resourceGroupName, name, lab).GetAwaiter().GetResult(); + return operations.UpdateAsync(name, lab).GetAwaiter().GetResult(); } /// @@ -255,9 +228,6 @@ public static Lab Update(this ILabsOperations operations, string resourceGroupNa /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -267,9 +237,9 @@ public static Lab Update(this ILabsOperations operations, string resourceGroupNa /// /// The cancellation token. /// - public static async Task UpdateAsync(this ILabsOperations operations, string resourceGroupName, string name, LabFragment lab, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ILabsOperations operations, string name, LabFragment lab, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, name, lab, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -282,15 +252,12 @@ public static Lab Update(this ILabsOperations operations, string resourceGroupNa /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// - public static void ClaimAnyVm(this ILabsOperations operations, string resourceGroupName, string name) + public static void ClaimAnyVm(this ILabsOperations operations, string name) { - operations.ClaimAnyVmAsync(resourceGroupName, name).GetAwaiter().GetResult(); + operations.ClaimAnyVmAsync(name).GetAwaiter().GetResult(); } /// @@ -300,18 +267,15 @@ public static void ClaimAnyVm(this ILabsOperations operations, string resourceGr /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The cancellation token. /// - public static async Task ClaimAnyVmAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ClaimAnyVmAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ClaimAnyVmWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ClaimAnyVmWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -321,18 +285,15 @@ public static void ClaimAnyVm(this ILabsOperations operations, string resourceGr /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// Properties for creating a virtual machine. /// - public static void CreateEnvironment(this ILabsOperations operations, string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) + public static void CreateEnvironment(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { - operations.CreateEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); + operations.CreateEnvironmentAsync(name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); } /// @@ -342,9 +303,6 @@ public static void CreateEnvironment(this ILabsOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -354,9 +312,9 @@ public static void CreateEnvironment(this ILabsOperations operations, string res /// /// The cancellation token. /// - public static async Task CreateEnvironmentAsync(this ILabsOperations operations, string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateEnvironmentAsync(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.CreateEnvironmentWithHttpMessagesAsync(resourceGroupName, name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.CreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -366,18 +324,15 @@ public static void CreateEnvironment(this ILabsOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The parameters of the export operation. /// - public static void ExportResourceUsage(this ILabsOperations operations, string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters) + public static void ExportResourceUsage(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters) { - operations.ExportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters).GetAwaiter().GetResult(); + operations.ExportResourceUsageAsync(name, exportResourceUsageParameters).GetAwaiter().GetResult(); } /// @@ -387,9 +342,6 @@ public static void ExportResourceUsage(this ILabsOperations operations, string r /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -399,9 +351,9 @@ public static void ExportResourceUsage(this ILabsOperations operations, string r /// /// The cancellation token. /// - public static async Task ExportResourceUsageAsync(this ILabsOperations operations, string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExportResourceUsageAsync(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ExportResourceUsageWithHttpMessagesAsync(resourceGroupName, name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -410,18 +362,15 @@ public static void ExportResourceUsage(this ILabsOperations operations, string r /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// Properties for generating an upload URI. /// - public static GenerateUploadUriResponse GenerateUploadUri(this ILabsOperations operations, string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter) + public static GenerateUploadUriResponse GenerateUploadUri(this ILabsOperations operations, string name, GenerateUploadUriParameter generateUploadUriParameter) { - return operations.GenerateUploadUriAsync(resourceGroupName, name, generateUploadUriParameter).GetAwaiter().GetResult(); + return operations.GenerateUploadUriAsync(name, generateUploadUriParameter).GetAwaiter().GetResult(); } /// @@ -430,9 +379,6 @@ public static GenerateUploadUriResponse GenerateUploadUri(this ILabsOperations o /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -442,76 +388,26 @@ public static GenerateUploadUriResponse GenerateUploadUri(this ILabsOperations o /// /// The cancellation token. /// - public static async Task GenerateUploadUriAsync(this ILabsOperations operations, string resourceGroupName, string name, GenerateUploadUriParameter generateUploadUriParameter, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GenerateUploadUriAsync(this ILabsOperations operations, string name, GenerateUploadUriParameter generateUploadUriParameter, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GenerateUploadUriWithHttpMessagesAsync(resourceGroupName, name, generateUploadUriParameter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GenerateUploadUriWithHttpMessagesAsync(name, generateUploadUriParameter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Import a virtual machine into a different lab. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// This represents the payload required to import a virtual machine from a - /// different lab into the current one - /// - public static void ImportVirtualMachine(this ILabsOperations operations, string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) - { - operations.ImportVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest).GetAwaiter().GetResult(); - } - - /// - /// Import a virtual machine into a different lab. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// This represents the payload required to import a virtual machine from a - /// different lab into the current one - /// - /// - /// The cancellation token. - /// - public static async Task ImportVirtualMachineAsync(this ILabsOperations operations, string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ImportVirtualMachineWithHttpMessagesAsync(resourceGroupName, name, importLabVirtualMachineRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// List disk images available for custom image creation. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// - public static IPage ListVhds(this ILabsOperations operations, string resourceGroupName, string name) + public static IPage ListVhds(this ILabsOperations operations, string name) { - return operations.ListVhdsAsync(resourceGroupName, name).GetAwaiter().GetResult(); + return operations.ListVhdsAsync(name).GetAwaiter().GetResult(); } /// @@ -520,18 +416,15 @@ public static IPage ListVhds(this ILabsOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The cancellation token. /// - public static async Task> ListVhdsAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListVhdsAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListVhdsWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListVhdsWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -544,18 +437,15 @@ public static IPage ListVhds(this ILabsOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// A lab. /// - public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string resourceGroupName, string name, Lab lab) + public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string name, Lab lab) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, name, lab).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(name, lab).GetAwaiter().GetResult(); } /// @@ -565,9 +455,6 @@ public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string re /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -577,9 +464,9 @@ public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string re /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this ILabsOperations operations, string resourceGroupName, string name, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this ILabsOperations operations, string name, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, lab, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -591,15 +478,12 @@ public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string re /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// - public static void BeginDelete(this ILabsOperations operations, string resourceGroupName, string name) + public static void BeginDelete(this ILabsOperations operations, string name) { - operations.BeginDeleteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(name).GetAwaiter().GetResult(); } /// @@ -608,18 +492,15 @@ public static void BeginDelete(this ILabsOperations operations, string resourceG /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -629,15 +510,12 @@ public static void BeginDelete(this ILabsOperations operations, string resourceG /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// - public static void BeginClaimAnyVm(this ILabsOperations operations, string resourceGroupName, string name) + public static void BeginClaimAnyVm(this ILabsOperations operations, string name) { - operations.BeginClaimAnyVmAsync(resourceGroupName, name).GetAwaiter().GetResult(); + operations.BeginClaimAnyVmAsync(name).GetAwaiter().GetResult(); } /// @@ -647,18 +525,15 @@ public static void BeginClaimAnyVm(this ILabsOperations operations, string resou /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The cancellation token. /// - public static async Task BeginClaimAnyVmAsync(this ILabsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginClaimAnyVmAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginClaimAnyVmWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginClaimAnyVmWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -668,18 +543,15 @@ public static void BeginClaimAnyVm(this ILabsOperations operations, string resou /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// Properties for creating a virtual machine. /// - public static void BeginCreateEnvironment(this ILabsOperations operations, string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) + public static void BeginCreateEnvironment(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { - operations.BeginCreateEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); + operations.BeginCreateEnvironmentAsync(name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); } /// @@ -689,9 +561,6 @@ public static void BeginCreateEnvironment(this ILabsOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -701,9 +570,9 @@ public static void BeginCreateEnvironment(this ILabsOperations operations, strin /// /// The cancellation token. /// - public static async Task BeginCreateEnvironmentAsync(this ILabsOperations operations, string resourceGroupName, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateEnvironmentAsync(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginCreateEnvironmentWithHttpMessagesAsync(resourceGroupName, name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginCreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -713,18 +582,15 @@ public static void BeginCreateEnvironment(this ILabsOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The parameters of the export operation. /// - public static void BeginExportResourceUsage(this ILabsOperations operations, string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters) + public static void BeginExportResourceUsage(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters) { - operations.BeginExportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters).GetAwaiter().GetResult(); + operations.BeginExportResourceUsageAsync(name, exportResourceUsageParameters).GetAwaiter().GetResult(); } /// @@ -734,9 +600,6 @@ public static void BeginExportResourceUsage(this ILabsOperations operations, str /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -746,56 +609,9 @@ public static void BeginExportResourceUsage(this ILabsOperations operations, str /// /// The cancellation token. /// - public static async Task BeginExportResourceUsageAsync(this ILabsOperations operations, string resourceGroupName, string name, ExportResourceUsageParameters exportResourceUsageParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginExportResourceUsageWithHttpMessagesAsync(resourceGroupName, name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Import a virtual machine into a different lab. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// This represents the payload required to import a virtual machine from a - /// different lab into the current one - /// - public static void BeginImportVirtualMachine(this ILabsOperations operations, string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) - { - operations.BeginImportVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest).GetAwaiter().GetResult(); - } - - /// - /// Import a virtual machine into a different lab. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// This represents the payload required to import a virtual machine from a - /// different lab into the current one - /// - /// - /// The cancellation token. - /// - public static async Task BeginImportVirtualMachineAsync(this ILabsOperations operations, string resourceGroupName, string name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginExportResourceUsageAsync(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginImportVirtualMachineWithHttpMessagesAsync(resourceGroupName, name, importLabVirtualMachineRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs index e456a95130d5..82e9e38194f0 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// defined on a VM or on lab level. /// [Rest.Serialization.JsonTransformation] - public partial class ApplicableScheduleFragment : UpdateResource + public partial class ApplicableScheduleFragment : Resource { /// /// Initializes a new instance of the ApplicableScheduleFragment class. @@ -35,13 +35,17 @@ public ApplicableScheduleFragment() /// /// Initializes a new instance of the ApplicableScheduleFragment class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// The auto-shutdown schedule, if one has /// been set at the lab or lab resource level. /// The auto-startup schedule, if one has /// been set at the lab or lab resource level. - public ApplicableScheduleFragment(IDictionary tags = default(IDictionary), ScheduleFragment labVmsShutdown = default(ScheduleFragment), ScheduleFragment labVmsStartup = default(ScheduleFragment)) - : base(tags) + public ApplicableScheduleFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ScheduleFragment labVmsShutdown = default(ScheduleFragment), ScheduleFragment labVmsStartup = default(ScheduleFragment)) + : base(id, name, type, location, tags) { LabVmsShutdown = labVmsShutdown; LabVmsStartup = labVmsStartup; diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs index 2c7de5897125..7afb6ed6171b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs @@ -51,9 +51,7 @@ public ArmTemplate() /// File name and parameter /// values information from all azuredeploy.*.parameters.json for the /// ARM template. - /// Whether or not ARM template is enabled for - /// use by lab user. - public ArmTemplate(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string displayName = default(string), string description = default(string), string publisher = default(string), string icon = default(string), object contents = default(object), System.DateTime? createdDate = default(System.DateTime?), IList parametersValueFilesInfo = default(IList), bool? enabled = default(bool?)) + public ArmTemplate(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string displayName = default(string), string description = default(string), string publisher = default(string), string icon = default(string), object contents = default(object), System.DateTime? createdDate = default(System.DateTime?), IList parametersValueFilesInfo = default(IList)) : base(id, name, type, location, tags) { DisplayName = displayName; @@ -63,7 +61,6 @@ public ArmTemplate() Contents = contents; CreatedDate = createdDate; ParametersValueFilesInfo = parametersValueFilesInfo; - Enabled = enabled; CustomInit(); } @@ -115,11 +112,5 @@ public ArmTemplate() [JsonProperty(PropertyName = "properties.parametersValueFilesInfo")] public IList ParametersValueFilesInfo { get; private set; } - /// - /// Gets whether or not ARM template is enabled for use by lab user. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; private set; } - } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterPropertiesFragment.cs deleted file mode 100644 index 404902a83d4c..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterPropertiesFragment.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties of an Azure Resource Manager template parameter. - /// - public partial class ArmTemplateParameterPropertiesFragment - { - /// - /// Initializes a new instance of the - /// ArmTemplateParameterPropertiesFragment class. - /// - public ArmTemplateParameterPropertiesFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ArmTemplateParameterPropertiesFragment class. - /// - /// The name of the template parameter. - /// The value of the template parameter. - public ArmTemplateParameterPropertiesFragment(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 template parameter. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the value of the template parameter. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs index cf274a8d7771..549835c1abc1 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs @@ -32,7 +32,6 @@ public ArtifactInstallProperties() /// Initializes a new instance of the ArtifactInstallProperties class. /// /// The artifact's identifier. - /// The artifact's title. /// The parameters of the artifact. /// The status of the artifact. /// The status message from the @@ -41,10 +40,9 @@ public ArtifactInstallProperties() /// virtual machine extension. /// The time that the artifact starts to /// install on the virtual machine. - public ArtifactInstallProperties(string artifactId = default(string), string artifactTitle = default(string), IList parameters = default(IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + public ArtifactInstallProperties(string artifactId = default(string), IList parameters = default(IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) { ArtifactId = artifactId; - ArtifactTitle = artifactTitle; Parameters = parameters; Status = status; DeploymentStatusMessage = deploymentStatusMessage; @@ -64,12 +62,6 @@ public ArtifactInstallProperties() [JsonProperty(PropertyName = "artifactId")] public string ArtifactId { get; set; } - /// - /// Gets or sets the artifact's title. - /// - [JsonProperty(PropertyName = "artifactTitle")] - public string ArtifactTitle { get; set; } - /// /// Gets or sets the parameters of the artifact. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs index 8968c44e8fb3..1ed69b046199 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs @@ -34,7 +34,6 @@ public ArtifactInstallPropertiesFragment() /// class. /// /// The artifact's identifier. - /// The artifact's title. /// The parameters of the artifact. /// The status of the artifact. /// The status message from the @@ -43,10 +42,9 @@ public ArtifactInstallPropertiesFragment() /// virtual machine extension. /// The time that the artifact starts to /// install on the virtual machine. - public ArtifactInstallPropertiesFragment(string artifactId = default(string), string artifactTitle = default(string), IList parameters = default(IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + public ArtifactInstallPropertiesFragment(string artifactId = default(string), IList parameters = default(IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) { ArtifactId = artifactId; - ArtifactTitle = artifactTitle; Parameters = parameters; Status = status; DeploymentStatusMessage = deploymentStatusMessage; @@ -66,12 +64,6 @@ public ArtifactInstallPropertiesFragment() [JsonProperty(PropertyName = "artifactId")] public string ArtifactId { get; set; } - /// - /// Gets or sets the artifact's title. - /// - [JsonProperty(PropertyName = "artifactTitle")] - public string ArtifactTitle { get; set; } - /// /// Gets or sets the parameters of the artifact. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs index 85b0622e561a..fc8cc3fe327e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs @@ -141,16 +141,16 @@ public ArtifactSource() public System.DateTime? CreatedDate { get; private set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs index 4a7bd416782d..f4b5624edf83 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// Properties of an artifact source. /// [Rest.Serialization.JsonTransformation] - public partial class ArtifactSourceFragment : UpdateResource + public partial class ArtifactSourceFragment : Resource { /// /// Initializes a new instance of the ArtifactSourceFragment class. @@ -34,6 +34,10 @@ public ArtifactSourceFragment() /// /// Initializes a new instance of the ArtifactSourceFragment class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// The artifact source's display /// name. @@ -50,8 +54,12 @@ public ArtifactSourceFragment() /// Indicates if the artifact source is enabled /// (values: Enabled, Disabled). Possible values include: 'Enabled', /// 'Disabled' - public ArtifactSourceFragment(IDictionary tags = default(IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string)) - : base(tags) + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public ArtifactSourceFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) { DisplayName = displayName; Uri = uri; @@ -61,6 +69,8 @@ public ArtifactSourceFragment() BranchRef = branchRef; SecurityToken = securityToken; Status = status; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -121,5 +131,17 @@ public ArtifactSourceFragment() [JsonProperty(PropertyName = "properties.status")] public string Status { get; set; } + /// + /// Gets or sets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } + } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptionsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptionsFragment.cs deleted file mode 100644 index 33926cf4fa1e..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptionsFragment.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties to attach new disk to the Virtual Machine. - /// - public partial class AttachNewDataDiskOptionsFragment - { - /// - /// Initializes a new instance of the AttachNewDataDiskOptionsFragment - /// class. - /// - public AttachNewDataDiskOptionsFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AttachNewDataDiskOptionsFragment - /// class. - /// - /// Size of the disk to be attached in - /// GibiBytes. - /// The name of the disk to be attached. - /// The storage type for the disk (i.e. - /// Standard, Premium). Possible values include: 'Standard', - /// 'Premium' - public AttachNewDataDiskOptionsFragment(int? diskSizeGiB = default(int?), string diskName = default(string), string diskType = default(string)) - { - DiskSizeGiB = diskSizeGiB; - DiskName = diskName; - DiskType = diskType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets size of the disk to be attached in GibiBytes. - /// - [JsonProperty(PropertyName = "diskSizeGiB")] - public int? DiskSizeGiB { get; set; } - - /// - /// Gets or sets the name of the disk to be attached. - /// - [JsonProperty(PropertyName = "diskName")] - public string DiskName { get; set; } - - /// - /// Gets or sets the storage type for the disk (i.e. Standard, - /// Premium). Possible values include: 'Standard', 'Premium' - /// - [JsonProperty(PropertyName = "diskType")] - public string DiskType { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParametersFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParametersFragment.cs deleted file mode 100644 index 77f9e4ef715d..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParametersFragment.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Parameters for creating multiple virtual machines as a single action. - /// - public partial class BulkCreationParametersFragment - { - /// - /// Initializes a new instance of the BulkCreationParametersFragment - /// class. - /// - public BulkCreationParametersFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the BulkCreationParametersFragment - /// class. - /// - /// The number of virtual machine instances - /// to create. - public BulkCreationParametersFragment(int? instanceCount = default(int?)) - { - InstanceCount = instanceCount; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the number of virtual machine instances to create. - /// - [JsonProperty(PropertyName = "instanceCount")] - public int? InstanceCount { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs index 483d2b76f030..a293da2d5257 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs @@ -50,20 +50,11 @@ public CustomImage() /// image. /// The Managed Image Id backing the /// custom image. - /// The Managed Snapshot Id backing the - /// custom image. - /// Storage information about the - /// data disks present in the custom image - /// Storage information about the plan - /// related to this custom image - /// Whether or not the custom images - /// underlying offer/plan has been enabled for programmatic - /// deployment /// The provisioning status of the /// resource. /// The unique immutable identifier of a /// resource (Guid). - public CustomImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), CustomImagePropertiesFromVm vm = default(CustomImagePropertiesFromVm), CustomImagePropertiesCustom vhd = default(CustomImagePropertiesCustom), string description = default(string), string author = default(string), System.DateTime? creationDate = default(System.DateTime?), string managedImageId = default(string), string managedSnapshotId = default(string), IList dataDiskStorageInfo = default(IList), CustomImagePropertiesFromPlan customImagePlan = default(CustomImagePropertiesFromPlan), bool? isPlanAuthorized = default(bool?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + public CustomImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), CustomImagePropertiesFromVm vm = default(CustomImagePropertiesFromVm), CustomImagePropertiesCustom vhd = default(CustomImagePropertiesCustom), string description = default(string), string author = default(string), System.DateTime? creationDate = default(System.DateTime?), string managedImageId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) : base(id, name, type, location, tags) { Vm = vm; @@ -72,10 +63,6 @@ public CustomImage() Author = author; CreationDate = creationDate; ManagedImageId = managedImageId; - ManagedSnapshotId = managedSnapshotId; - DataDiskStorageInfo = dataDiskStorageInfo; - CustomImagePlan = customImagePlan; - IsPlanAuthorized = isPlanAuthorized; ProvisioningState = provisioningState; UniqueIdentifier = uniqueIdentifier; CustomInit(); @@ -124,43 +111,16 @@ public CustomImage() public string ManagedImageId { get; set; } /// - /// Gets or sets the Managed Snapshot Id backing the custom image. - /// - [JsonProperty(PropertyName = "properties.managedSnapshotId")] - public string ManagedSnapshotId { get; set; } - - /// - /// Gets or sets storage information about the data disks present in - /// the custom image - /// - [JsonProperty(PropertyName = "properties.dataDiskStorageInfo")] - public IList DataDiskStorageInfo { get; set; } - - /// - /// Gets or sets storage information about the plan related to this - /// custom image - /// - [JsonProperty(PropertyName = "properties.customImagePlan")] - public CustomImagePropertiesFromPlan CustomImagePlan { get; set; } - - /// - /// Gets or sets whether or not the custom images underlying offer/plan - /// has been enabled for programmatic deployment - /// - [JsonProperty(PropertyName = "properties.isPlanAuthorized")] - public bool? IsPlanAuthorized { get; set; } - - /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } /// /// Validate the object. diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageFragment.cs deleted file mode 100644 index 38b0d9ac682b..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageFragment.cs +++ /dev/null @@ -1,135 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A custom image. - /// - [Rest.Serialization.JsonTransformation] - public partial class CustomImageFragment : UpdateResource - { - /// - /// Initializes a new instance of the CustomImageFragment class. - /// - public CustomImageFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CustomImageFragment class. - /// - /// The tags of the resource. - /// The virtual machine from which the image is to be - /// created. - /// The VHD from which the image is to be - /// created. - /// The description of the custom - /// image. - /// The author of the custom image. - /// The Managed Image Id backing the - /// custom image. - /// The Managed Snapshot Id backing the - /// custom image. - /// Storage information about the - /// data disks present in the custom image - /// Storage information about the plan - /// related to this custom image - /// Whether or not the custom images - /// underlying offer/plan has been enabled for programmatic - /// deployment - public CustomImageFragment(IDictionary tags = default(IDictionary), CustomImagePropertiesFromVmFragment vm = default(CustomImagePropertiesFromVmFragment), CustomImagePropertiesCustomFragment vhd = default(CustomImagePropertiesCustomFragment), string description = default(string), string author = default(string), string managedImageId = default(string), string managedSnapshotId = default(string), IList dataDiskStorageInfo = default(IList), CustomImagePropertiesFromPlanFragment customImagePlan = default(CustomImagePropertiesFromPlanFragment), bool? isPlanAuthorized = default(bool?)) - : base(tags) - { - Vm = vm; - Vhd = vhd; - Description = description; - Author = author; - ManagedImageId = managedImageId; - ManagedSnapshotId = managedSnapshotId; - DataDiskStorageInfo = dataDiskStorageInfo; - CustomImagePlan = customImagePlan; - IsPlanAuthorized = isPlanAuthorized; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the virtual machine from which the image is to be - /// created. - /// - [JsonProperty(PropertyName = "properties.vm")] - public CustomImagePropertiesFromVmFragment Vm { get; set; } - - /// - /// Gets or sets the VHD from which the image is to be created. - /// - [JsonProperty(PropertyName = "properties.vhd")] - public CustomImagePropertiesCustomFragment Vhd { get; set; } - - /// - /// Gets or sets the description of the custom image. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets the author of the custom image. - /// - [JsonProperty(PropertyName = "properties.author")] - public string Author { get; set; } - - /// - /// Gets or sets the Managed Image Id backing the custom image. - /// - [JsonProperty(PropertyName = "properties.managedImageId")] - public string ManagedImageId { get; set; } - - /// - /// Gets or sets the Managed Snapshot Id backing the custom image. - /// - [JsonProperty(PropertyName = "properties.managedSnapshotId")] - public string ManagedSnapshotId { get; set; } - - /// - /// Gets or sets storage information about the data disks present in - /// the custom image - /// - [JsonProperty(PropertyName = "properties.dataDiskStorageInfo")] - public IList DataDiskStorageInfo { get; set; } - - /// - /// Gets or sets storage information about the plan related to this - /// custom image - /// - [JsonProperty(PropertyName = "properties.customImagePlan")] - public CustomImagePropertiesFromPlanFragment CustomImagePlan { get; set; } - - /// - /// Gets or sets whether or not the custom images underlying offer/plan - /// has been enabled for programmatic deployment - /// - [JsonProperty(PropertyName = "properties.isPlanAuthorized")] - public bool? IsPlanAuthorized { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustomFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustomFragment.cs deleted file mode 100644 index 69a57595e5d7..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustomFragment.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties for creating a custom image from a VHD. - /// - public partial class CustomImagePropertiesCustomFragment - { - /// - /// Initializes a new instance of the - /// CustomImagePropertiesCustomFragment class. - /// - public CustomImagePropertiesCustomFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// CustomImagePropertiesCustomFragment class. - /// - /// The image name. - /// Indicates whether sysprep has been run on the - /// VHD. - /// The OS type of the custom image (i.e. Windows, - /// Linux). Possible values include: 'Windows', 'Linux', 'None' - public CustomImagePropertiesCustomFragment(string imageName = default(string), bool? sysPrep = default(bool?), string osType = default(string)) - { - ImageName = imageName; - SysPrep = sysPrep; - OsType = osType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the image name. - /// - [JsonProperty(PropertyName = "imageName")] - public string ImageName { get; set; } - - /// - /// Gets or sets indicates whether sysprep has been run on the VHD. - /// - [JsonProperty(PropertyName = "sysPrep")] - public bool? SysPrep { get; set; } - - /// - /// Gets or sets the OS type of the custom image (i.e. Windows, Linux). - /// Possible values include: 'Windows', 'Linux', 'None' - /// - [JsonProperty(PropertyName = "osType")] - public string OsType { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlan.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlan.cs deleted file mode 100644 index dee8539454bc..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlan.cs +++ /dev/null @@ -1,74 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties for plan on a custom image. - /// - public partial class CustomImagePropertiesFromPlan - { - /// - /// Initializes a new instance of the CustomImagePropertiesFromPlan - /// class. - /// - public CustomImagePropertiesFromPlan() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CustomImagePropertiesFromPlan - /// class. - /// - /// The id of the plan, equivalent to name of the - /// plan - /// The publisher for the plan from the - /// marketplace image the custom image is derived from - /// The offer for the plan from the marketplace - /// image the custom image is derived from - public CustomImagePropertiesFromPlan(string id = default(string), string publisher = default(string), string offer = default(string)) - { - Id = id; - Publisher = publisher; - Offer = offer; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the id of the plan, equivalent to name of the plan - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the publisher for the plan from the marketplace image - /// the custom image is derived from - /// - [JsonProperty(PropertyName = "publisher")] - public string Publisher { get; set; } - - /// - /// Gets or sets the offer for the plan from the marketplace image the - /// custom image is derived from - /// - [JsonProperty(PropertyName = "offer")] - public string Offer { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlanFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlanFragment.cs deleted file mode 100644 index 7a1ef66b95ea..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromPlanFragment.cs +++ /dev/null @@ -1,74 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties for plan on a custom image. - /// - public partial class CustomImagePropertiesFromPlanFragment - { - /// - /// Initializes a new instance of the - /// CustomImagePropertiesFromPlanFragment class. - /// - public CustomImagePropertiesFromPlanFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// CustomImagePropertiesFromPlanFragment class. - /// - /// The id of the plan, equivalent to name of the - /// plan - /// The publisher for the plan from the - /// marketplace image the custom image is derived from - /// The offer for the plan from the marketplace - /// image the custom image is derived from - public CustomImagePropertiesFromPlanFragment(string id = default(string), string publisher = default(string), string offer = default(string)) - { - Id = id; - Publisher = publisher; - Offer = offer; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the id of the plan, equivalent to name of the plan - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the publisher for the plan from the marketplace image - /// the custom image is derived from - /// - [JsonProperty(PropertyName = "publisher")] - public string Publisher { get; set; } - - /// - /// Gets or sets the offer for the plan from the marketplace image the - /// custom image is derived from - /// - [JsonProperty(PropertyName = "offer")] - public string Offer { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVmFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVmFragment.cs deleted file mode 100644 index ab699cbe6464..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVmFragment.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties for creating a custom image from a virtual machine. - /// - public partial class CustomImagePropertiesFromVmFragment - { - /// - /// Initializes a new instance of the - /// CustomImagePropertiesFromVmFragment class. - /// - public CustomImagePropertiesFromVmFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// CustomImagePropertiesFromVmFragment class. - /// - /// The source vm identifier. - /// The Windows OS information of the - /// VM. - /// The Linux OS information of the - /// VM. - public CustomImagePropertiesFromVmFragment(string sourceVmId = default(string), WindowsOsInfoFragment windowsOsInfo = default(WindowsOsInfoFragment), LinuxOsInfoFragment linuxOsInfo = default(LinuxOsInfoFragment)) - { - SourceVmId = sourceVmId; - WindowsOsInfo = windowsOsInfo; - LinuxOsInfo = linuxOsInfo; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the source vm identifier. - /// - [JsonProperty(PropertyName = "sourceVmId")] - public string SourceVmId { get; set; } - - /// - /// Gets or sets the Windows OS information of the VM. - /// - [JsonProperty(PropertyName = "windowsOsInfo")] - public WindowsOsInfoFragment WindowsOsInfo { get; set; } - - /// - /// Gets or sets the Linux OS information of the VM. - /// - [JsonProperty(PropertyName = "linuxOsInfo")] - public LinuxOsInfoFragment LinuxOsInfo { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskPropertiesFragment.cs deleted file mode 100644 index d1b8c1a11dd8..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskPropertiesFragment.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Request body for adding a new or existing data disk to a virtual - /// machine. - /// - public partial class DataDiskPropertiesFragment - { - /// - /// Initializes a new instance of the DataDiskPropertiesFragment class. - /// - public DataDiskPropertiesFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataDiskPropertiesFragment class. - /// - /// Specifies options to attach - /// a new disk to the virtual machine. - /// Specifies the existing lab disk id - /// to attach to virtual machine. - /// Caching option for a data disk (i.e. - /// None, ReadOnly, ReadWrite). Possible values include: 'None', - /// 'ReadOnly', 'ReadWrite' - public DataDiskPropertiesFragment(AttachNewDataDiskOptionsFragment attachNewDataDiskOptions = default(AttachNewDataDiskOptionsFragment), string existingLabDiskId = default(string), string hostCaching = default(string)) - { - AttachNewDataDiskOptions = attachNewDataDiskOptions; - ExistingLabDiskId = existingLabDiskId; - HostCaching = hostCaching; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets specifies options to attach a new disk to the virtual - /// machine. - /// - [JsonProperty(PropertyName = "attachNewDataDiskOptions")] - public AttachNewDataDiskOptionsFragment AttachNewDataDiskOptions { get; set; } - - /// - /// Gets or sets specifies the existing lab disk id to attach to - /// virtual machine. - /// - [JsonProperty(PropertyName = "existingLabDiskId")] - public string ExistingLabDiskId { get; set; } - - /// - /// Gets or sets caching option for a data disk (i.e. None, ReadOnly, - /// ReadWrite). Possible values include: 'None', 'ReadOnly', - /// 'ReadWrite' - /// - [JsonProperty(PropertyName = "hostCaching")] - public string HostCaching { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfo.cs deleted file mode 100644 index 71d238bd6573..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfo.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Storage information about the data disks present in the custom image - /// - public partial class DataDiskStorageTypeInfo - { - /// - /// Initializes a new instance of the DataDiskStorageTypeInfo class. - /// - public DataDiskStorageTypeInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataDiskStorageTypeInfo class. - /// - /// Disk Lun - /// Disk Storage Type. Possible values - /// include: 'Standard', 'Premium' - public DataDiskStorageTypeInfo(string lun = default(string), string storageType = default(string)) - { - Lun = lun; - StorageType = storageType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets disk Lun - /// - [JsonProperty(PropertyName = "lun")] - public string Lun { get; set; } - - /// - /// Gets or sets disk Storage Type. Possible values include: - /// 'Standard', 'Premium' - /// - [JsonProperty(PropertyName = "storageType")] - public string StorageType { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfoFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfoFragment.cs deleted file mode 100644 index e5bf351eb416..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskStorageTypeInfoFragment.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Storage information about the data disks present in the custom image - /// - public partial class DataDiskStorageTypeInfoFragment - { - /// - /// Initializes a new instance of the DataDiskStorageTypeInfoFragment - /// class. - /// - public DataDiskStorageTypeInfoFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataDiskStorageTypeInfoFragment - /// class. - /// - /// Disk Lun - /// Disk Storage Type. Possible values - /// include: 'Standard', 'Premium' - public DataDiskStorageTypeInfoFragment(string lun = default(string), string storageType = default(string)) - { - Lun = lun; - StorageType = storageType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets disk Lun - /// - [JsonProperty(PropertyName = "lun")] - public string Lun { get; set; } - - /// - /// Gets or sets disk Storage Type. Possible values include: - /// 'Standard', 'Premium' - /// - [JsonProperty(PropertyName = "storageType")] - public string StorageType { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs index 0402b2481089..6fdf24337a2e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs @@ -134,16 +134,16 @@ public Disk() public string ManagedDiskId { get; set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskFragment.cs deleted file mode 100644 index ba04894b7820..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskFragment.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A Disk. - /// - [Rest.Serialization.JsonTransformation] - public partial class DiskFragment : UpdateResource - { - /// - /// Initializes a new instance of the DiskFragment class. - /// - public DiskFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DiskFragment class. - /// - /// The tags of the resource. - /// The storage type for the disk (i.e. - /// Standard, Premium). Possible values include: 'Standard', - /// 'Premium' - /// The size of the disk in - /// GibiBytes. - /// The resource ID of the VM to which - /// this disk is leased. - /// When backed by a blob, the name of the - /// VHD blob without extension. - /// When backed by a blob, the URI of underlying - /// blob. - /// The host caching policy of the disk (i.e. - /// None, ReadOnly, ReadWrite). - /// When backed by managed disk, this is - /// the ID of the compute disk resource. - public DiskFragment(IDictionary tags = default(IDictionary), string diskType = default(string), int? diskSizeGiB = default(int?), string leasedByLabVmId = default(string), string diskBlobName = default(string), string diskUri = default(string), string hostCaching = default(string), string managedDiskId = default(string)) - : base(tags) - { - DiskType = diskType; - DiskSizeGiB = diskSizeGiB; - LeasedByLabVmId = leasedByLabVmId; - DiskBlobName = diskBlobName; - DiskUri = diskUri; - HostCaching = hostCaching; - ManagedDiskId = managedDiskId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the storage type for the disk (i.e. Standard, - /// Premium). Possible values include: 'Standard', 'Premium' - /// - [JsonProperty(PropertyName = "properties.diskType")] - public string DiskType { get; set; } - - /// - /// Gets or sets the size of the disk in GibiBytes. - /// - [JsonProperty(PropertyName = "properties.diskSizeGiB")] - public int? DiskSizeGiB { get; set; } - - /// - /// Gets or sets the resource ID of the VM to which this disk is - /// leased. - /// - [JsonProperty(PropertyName = "properties.leasedByLabVmId")] - public string LeasedByLabVmId { get; set; } - - /// - /// Gets or sets when backed by a blob, the name of the VHD blob - /// without extension. - /// - [JsonProperty(PropertyName = "properties.diskBlobName")] - public string DiskBlobName { get; set; } - - /// - /// Gets or sets when backed by a blob, the URI of underlying blob. - /// - [JsonProperty(PropertyName = "properties.diskUri")] - public string DiskUri { get; set; } - - /// - /// Gets or sets the host caching policy of the disk (i.e. None, - /// ReadOnly, ReadWrite). - /// - [JsonProperty(PropertyName = "properties.hostCaching")] - public string HostCaching { get; set; } - - /// - /// Gets or sets when backed by managed disk, this is the ID of the - /// compute disk resource. - /// - [JsonProperty(PropertyName = "properties.managedDiskId")] - public string ManagedDiskId { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs index 7fe0ae7b08b1..5522f701441e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs @@ -94,16 +94,16 @@ public DtlEnvironment() public string CreatedByUser { get; private set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironmentFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironmentFragment.cs deleted file mode 100644 index 935bd0aae51b..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironmentFragment.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An environment, which is essentially an ARM template deployment. - /// - [Rest.Serialization.JsonTransformation] - public partial class DtlEnvironmentFragment : UpdateResource - { - /// - /// Initializes a new instance of the DtlEnvironmentFragment class. - /// - public DtlEnvironmentFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DtlEnvironmentFragment class. - /// - /// The tags of the resource. - /// The deployment properties of the - /// environment. - /// The display name of the Azure - /// Resource Manager template that produced the environment. - public DtlEnvironmentFragment(IDictionary tags = default(IDictionary), EnvironmentDeploymentPropertiesFragment deploymentProperties = default(EnvironmentDeploymentPropertiesFragment), string armTemplateDisplayName = default(string)) - : base(tags) - { - DeploymentProperties = deploymentProperties; - ArmTemplateDisplayName = armTemplateDisplayName; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the deployment properties of the environment. - /// - [JsonProperty(PropertyName = "properties.deploymentProperties")] - public EnvironmentDeploymentPropertiesFragment DeploymentProperties { get; set; } - - /// - /// Gets or sets the display name of the Azure Resource Manager - /// template that produced the environment. - /// - [JsonProperty(PropertyName = "properties.armTemplateDisplayName")] - public string ArmTemplateDisplayName { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentPropertiesFragment.cs deleted file mode 100644 index 6e9038a43d85..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentPropertiesFragment.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Properties of an environment deployment. - /// - public partial class EnvironmentDeploymentPropertiesFragment - { - /// - /// Initializes a new instance of the - /// EnvironmentDeploymentPropertiesFragment class. - /// - public EnvironmentDeploymentPropertiesFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// EnvironmentDeploymentPropertiesFragment class. - /// - /// The Azure Resource Manager template's - /// identifier. - /// The parameters of the Azure Resource - /// Manager template. - public EnvironmentDeploymentPropertiesFragment(string armTemplateId = default(string), IList parameters = default(IList)) - { - ArmTemplateId = armTemplateId; - Parameters = parameters; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Azure Resource Manager template's identifier. - /// - [JsonProperty(PropertyName = "armTemplateId")] - public string ArmTemplateId { get; set; } - - /// - /// Gets or sets the parameters of the Azure Resource Manager template. - /// - [JsonProperty(PropertyName = "parameters")] - public IList Parameters { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs index 89941f6b30ef..5a099faed54a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs @@ -32,14 +32,11 @@ public EvaluatePoliciesProperties() /// The fact name. /// The fact data. /// The value offset. - /// The user for which policies will be - /// evaluated - public EvaluatePoliciesProperties(string factName = default(string), string factData = default(string), string valueOffset = default(string), string userObjectId = default(string)) + public EvaluatePoliciesProperties(string factName = default(string), string factData = default(string), string valueOffset = default(string)) { FactName = factName; FactData = factData; ValueOffset = valueOffset; - UserObjectId = userObjectId; CustomInit(); } @@ -66,11 +63,5 @@ public EvaluatePoliciesProperties() [JsonProperty(PropertyName = "valueOffset")] public string ValueOffset { get; set; } - /// - /// Gets or sets the user for which policies will be evaluated - /// - [JsonProperty(PropertyName = "userObjectId")] - public string UserObjectId { get; set; } - } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs index 7263423b236b..6551596f5142 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs @@ -109,16 +109,16 @@ public Formula() public FormulaPropertiesFromVm Vm { get; set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaFragment.cs deleted file mode 100644 index a47688ce15b4..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaFragment.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A formula for creating a VM, specifying an image base and other - /// parameters - /// - [Rest.Serialization.JsonTransformation] - public partial class FormulaFragment : UpdateResource - { - /// - /// Initializes a new instance of the FormulaFragment class. - /// - public FormulaFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the FormulaFragment class. - /// - /// The tags of the resource. - /// The description of the formula. - /// The author of the formula. - /// The OS type of the formula. - /// The content of the formula. - /// Information about a VM from which a formula is to - /// be created. - public FormulaFragment(IDictionary tags = default(IDictionary), string description = default(string), string author = default(string), string osType = default(string), LabVirtualMachineCreationParameterFragment formulaContent = default(LabVirtualMachineCreationParameterFragment), FormulaPropertiesFromVmFragment vm = default(FormulaPropertiesFromVmFragment)) - : base(tags) - { - Description = description; - Author = author; - OsType = osType; - FormulaContent = formulaContent; - Vm = vm; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the description of the formula. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets the author of the formula. - /// - [JsonProperty(PropertyName = "properties.author")] - public string Author { get; set; } - - /// - /// Gets or sets the OS type of the formula. - /// - [JsonProperty(PropertyName = "properties.osType")] - public string OsType { get; set; } - - /// - /// Gets or sets the content of the formula. - /// - [JsonProperty(PropertyName = "properties.formulaContent")] - public LabVirtualMachineCreationParameterFragment FormulaContent { get; set; } - - /// - /// Gets or sets information about a VM from which a formula is to be - /// created. - /// - [JsonProperty(PropertyName = "properties.vm")] - public FormulaPropertiesFromVmFragment Vm { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVmFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVmFragment.cs deleted file mode 100644 index d8a6d8b0fe34..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVmFragment.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Information about a VM from which a formula is to be created. - /// - public partial class FormulaPropertiesFromVmFragment - { - /// - /// Initializes a new instance of the FormulaPropertiesFromVmFragment - /// class. - /// - public FormulaPropertiesFromVmFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the FormulaPropertiesFromVmFragment - /// class. - /// - /// The identifier of the VM from which a formula - /// is to be created. - public FormulaPropertiesFromVmFragment(string labVmId = default(string)) - { - LabVmId = labVmId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the identifier of the VM from which a formula is to be - /// created. - /// - [JsonProperty(PropertyName = "labVmId")] - public string LabVmId { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs index 6ce3d112757e..6471ae4f7d3b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs @@ -49,11 +49,7 @@ public GalleryImage() /// The icon of the gallery image. /// Indicates whether this gallery image is /// enabled. - /// The third party plan that applies to this - /// image - /// Indicates if the plan has been - /// authorized for programmatic deployment. - public GalleryImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?), string planId = default(string), bool? isPlanAuthorized = default(bool?)) + public GalleryImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?)) : base(id, name, type, location, tags) { Author = author; @@ -62,8 +58,6 @@ public GalleryImage() ImageReference = imageReference; Icon = icon; Enabled = enabled; - PlanId = planId; - IsPlanAuthorized = isPlanAuthorized; CustomInit(); } @@ -108,18 +102,5 @@ public GalleryImage() [JsonProperty(PropertyName = "properties.enabled")] public bool? Enabled { get; set; } - /// - /// Gets or sets the third party plan that applies to this image - /// - [JsonProperty(PropertyName = "properties.planId")] - public string PlanId { get; set; } - - /// - /// Gets or sets indicates if the plan has been authorized for - /// programmatic deployment. - /// - [JsonProperty(PropertyName = "properties.isPlanAuthorized")] - public bool? IsPlanAuthorized { get; set; } - } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ImportLabVirtualMachineRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ImportLabVirtualMachineRequest.cs deleted file mode 100644 index fc9e89c9ab18..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ImportLabVirtualMachineRequest.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// This represents the payload required to import a virtual machine from a - /// different lab into the current one - /// - public partial class ImportLabVirtualMachineRequest - { - /// - /// Initializes a new instance of the ImportLabVirtualMachineRequest - /// class. - /// - public ImportLabVirtualMachineRequest() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ImportLabVirtualMachineRequest - /// class. - /// - /// The full resource ID - /// of the virtual machine to be imported. - /// The name of the virtual - /// machine in the destination lab - public ImportLabVirtualMachineRequest(string sourceVirtualMachineResourceId = default(string), string destinationVirtualMachineName = default(string)) - { - SourceVirtualMachineResourceId = sourceVirtualMachineResourceId; - DestinationVirtualMachineName = destinationVirtualMachineName; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the full resource ID of the virtual machine to be - /// imported. - /// - [JsonProperty(PropertyName = "sourceVirtualMachineResourceId")] - public string SourceVirtualMachineResourceId { get; set; } - - /// - /// Gets or sets the name of the virtual machine in the destination lab - /// - [JsonProperty(PropertyName = "destinationVirtualMachineName")] - public string DestinationVirtualMachineName { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs index 59638a9abbf3..bf9767e4c2e7 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs @@ -51,14 +51,6 @@ public Lab() /// Type of storage used by the lab. It /// can be either Premium or Standard. Default is Premium. Possible /// values include: 'Standard', 'Premium' - /// The ordered list - /// of artifact resource IDs that should be applied on all Linux VM - /// creations by default, prior to the artifacts specified by the - /// user. - /// The ordered list - /// of artifact resource IDs that should be applied on all Windows VM - /// creations by default, prior to the artifacts specified by the - /// user. /// The creation date of the lab. /// The setting to enable usage of /// premium data disks. @@ -66,29 +58,11 @@ public Lab() /// disks is allowed. /// When its value is 'Disabled', only creation of standard data disks /// is allowed. Possible values include: 'Disabled', 'Enabled' - /// The access rights to be granted - /// to the user when provisioning an environment. Possible values - /// include: 'Reader', 'Contributor' - /// The properties of any lab announcement - /// associated with this lab - /// The properties of any lab support message - /// associated with this lab - /// The resource group in which - /// lab virtual machines will be created in. - /// The public IP address for the lab's load - /// balancer. - /// The load balancer used to for lab VMs - /// that use shared IP address. - /// The Network Security Group - /// attached to the lab VMs Network interfaces to restrict open - /// ports. - /// Extended properties of the lab - /// used for experimental features /// The provisioning status of the /// resource. /// The unique immutable identifier of a /// resource (Guid). - public Lab(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string defaultStorageAccount = default(string), string defaultPremiumStorageAccount = default(string), string artifactsStorageAccount = default(string), string premiumDataDiskStorageAccount = default(string), string vaultName = default(string), string labStorageType = default(string), IList mandatoryArtifactsResourceIdsLinux = default(IList), IList mandatoryArtifactsResourceIdsWindows = default(IList), System.DateTime? createdDate = default(System.DateTime?), string premiumDataDisks = default(string), string environmentPermission = default(string), LabAnnouncementProperties announcement = default(LabAnnouncementProperties), LabSupportProperties support = default(LabSupportProperties), string vmCreationResourceGroup = default(string), string publicIpId = default(string), string loadBalancerId = default(string), string networkSecurityGroupId = default(string), IDictionary extendedProperties = default(IDictionary), string provisioningState = default(string), string uniqueIdentifier = default(string)) + public Lab(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string defaultStorageAccount = default(string), string defaultPremiumStorageAccount = default(string), string artifactsStorageAccount = default(string), string premiumDataDiskStorageAccount = default(string), string vaultName = default(string), string labStorageType = default(string), System.DateTime? createdDate = default(System.DateTime?), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) : base(id, name, type, location, tags) { DefaultStorageAccount = defaultStorageAccount; @@ -97,18 +71,8 @@ public Lab() PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; VaultName = vaultName; LabStorageType = labStorageType; - MandatoryArtifactsResourceIdsLinux = mandatoryArtifactsResourceIdsLinux; - MandatoryArtifactsResourceIdsWindows = mandatoryArtifactsResourceIdsWindows; CreatedDate = createdDate; PremiumDataDisks = premiumDataDisks; - EnvironmentPermission = environmentPermission; - Announcement = announcement; - Support = support; - VmCreationResourceGroup = vmCreationResourceGroup; - PublicIpId = publicIpId; - LoadBalancerId = loadBalancerId; - NetworkSecurityGroupId = networkSecurityGroupId; - ExtendedProperties = extendedProperties; ProvisioningState = provisioningState; UniqueIdentifier = uniqueIdentifier; CustomInit(); @@ -157,22 +121,6 @@ public Lab() [JsonProperty(PropertyName = "properties.labStorageType")] public string LabStorageType { get; set; } - /// - /// Gets or sets the ordered list of artifact resource IDs that should - /// be applied on all Linux VM creations by default, prior to the - /// artifacts specified by the user. - /// - [JsonProperty(PropertyName = "properties.mandatoryArtifactsResourceIdsLinux")] - public IList MandatoryArtifactsResourceIdsLinux { get; set; } - - /// - /// Gets or sets the ordered list of artifact resource IDs that should - /// be applied on all Windows VM creations by default, prior to the - /// artifacts specified by the user. - /// - [JsonProperty(PropertyName = "properties.mandatoryArtifactsResourceIdsWindows")] - public IList MandatoryArtifactsResourceIdsWindows { get; set; } - /// /// Gets the creation date of the lab. /// @@ -190,72 +138,16 @@ public Lab() public string PremiumDataDisks { get; set; } /// - /// Gets or sets the access rights to be granted to the user when - /// provisioning an environment. Possible values include: 'Reader', - /// 'Contributor' - /// - [JsonProperty(PropertyName = "properties.environmentPermission")] - public string EnvironmentPermission { get; set; } - - /// - /// Gets or sets the properties of any lab announcement associated with - /// this lab - /// - [JsonProperty(PropertyName = "properties.announcement")] - public LabAnnouncementProperties Announcement { get; set; } - - /// - /// Gets or sets the properties of any lab support message associated - /// with this lab - /// - [JsonProperty(PropertyName = "properties.support")] - public LabSupportProperties Support { get; set; } - - /// - /// Gets the resource group in which lab virtual machines will be - /// created in. - /// - [JsonProperty(PropertyName = "properties.vmCreationResourceGroup")] - public string VmCreationResourceGroup { get; private set; } - - /// - /// Gets the public IP address for the lab's load balancer. - /// - [JsonProperty(PropertyName = "properties.publicIpId")] - public string PublicIpId { get; private set; } - - /// - /// Gets the load balancer used to for lab VMs that use shared IP - /// address. - /// - [JsonProperty(PropertyName = "properties.loadBalancerId")] - public string LoadBalancerId { get; private set; } - - /// - /// Gets the Network Security Group attached to the lab VMs Network - /// interfaces to restrict open ports. - /// - [JsonProperty(PropertyName = "properties.networkSecurityGroupId")] - public string NetworkSecurityGroupId { get; private set; } - - /// - /// Gets or sets extended properties of the lab used for experimental - /// features - /// - [JsonProperty(PropertyName = "properties.extendedProperties")] - public IDictionary ExtendedProperties { get; set; } - - /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementProperties.cs deleted file mode 100644 index 8a2657810b8b..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementProperties.cs +++ /dev/null @@ -1,109 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties of a lab's announcement banner - /// - public partial class LabAnnouncementProperties - { - /// - /// Initializes a new instance of the LabAnnouncementProperties class. - /// - public LabAnnouncementProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LabAnnouncementProperties class. - /// - /// The plain text title for the lab - /// announcement - /// The markdown text (if any) that this lab - /// displays in the UI. If left empty/null, nothing will be - /// shown. - /// Is the lab announcement active/enabled at - /// this time?. Possible values include: 'Enabled', 'Disabled' - /// The time at which the announcement - /// expires (null for never) - /// Has this announcement expired? - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public LabAnnouncementProperties(string title = default(string), string markdown = default(string), string enabled = default(string), System.DateTime? expirationDate = default(System.DateTime?), bool? expired = default(bool?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - { - Title = title; - Markdown = markdown; - Enabled = enabled; - ExpirationDate = expirationDate; - Expired = expired; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the plain text title for the lab announcement - /// - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - - /// - /// Gets or sets the markdown text (if any) that this lab displays in - /// the UI. If left empty/null, nothing will be shown. - /// - [JsonProperty(PropertyName = "markdown")] - public string Markdown { get; set; } - - /// - /// Gets or sets is the lab announcement active/enabled at this time?. - /// Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "enabled")] - public string Enabled { get; set; } - - /// - /// Gets or sets the time at which the announcement expires (null for - /// never) - /// - [JsonProperty(PropertyName = "expirationDate")] - public System.DateTime? ExpirationDate { get; set; } - - /// - /// Gets or sets has this announcement expired? - /// - [JsonProperty(PropertyName = "expired")] - public bool? Expired { get; set; } - - /// - /// Gets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementPropertiesFragment.cs deleted file mode 100644 index d6ac32c27317..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabAnnouncementPropertiesFragment.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties of a lab's announcement banner - /// - public partial class LabAnnouncementPropertiesFragment - { - /// - /// Initializes a new instance of the LabAnnouncementPropertiesFragment - /// class. - /// - public LabAnnouncementPropertiesFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LabAnnouncementPropertiesFragment - /// class. - /// - /// The plain text title for the lab - /// announcement - /// The markdown text (if any) that this lab - /// displays in the UI. If left empty/null, nothing will be - /// shown. - /// Is the lab announcement active/enabled at - /// this time?. Possible values include: 'Enabled', 'Disabled' - /// The time at which the announcement - /// expires (null for never) - /// Has this announcement expired? - public LabAnnouncementPropertiesFragment(string title = default(string), string markdown = default(string), string enabled = default(string), System.DateTime? expirationDate = default(System.DateTime?), bool? expired = default(bool?)) - { - Title = title; - Markdown = markdown; - Enabled = enabled; - ExpirationDate = expirationDate; - Expired = expired; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the plain text title for the lab announcement - /// - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - - /// - /// Gets or sets the markdown text (if any) that this lab displays in - /// the UI. If left empty/null, nothing will be shown. - /// - [JsonProperty(PropertyName = "markdown")] - public string Markdown { get; set; } - - /// - /// Gets or sets is the lab announcement active/enabled at this time?. - /// Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "enabled")] - public string Enabled { get; set; } - - /// - /// Gets or sets the time at which the announcement expires (null for - /// never) - /// - [JsonProperty(PropertyName = "expirationDate")] - public System.DateTime? ExpirationDate { get; set; } - - /// - /// Gets or sets has this announcement expired? - /// - [JsonProperty(PropertyName = "expired")] - public bool? Expired { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs index 55e4b639853b..183dd8ada447 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs @@ -125,16 +125,16 @@ public LabCost() public System.DateTime? CreatedDate { get; set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs index d267fbdd502a..b6e84b1cb8ae 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// A lab. /// [Rest.Serialization.JsonTransformation] - public partial class LabFragment : UpdateResource + public partial class LabFragment : Resource { /// /// Initializes a new instance of the LabFragment class. @@ -34,44 +34,31 @@ public LabFragment() /// /// Initializes a new instance of the LabFragment class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// Type of storage used by the lab. It /// can be either Premium or Standard. Default is Premium. Possible /// values include: 'Standard', 'Premium' - /// The ordered list - /// of artifact resource IDs that should be applied on all Linux VM - /// creations by default, prior to the artifacts specified by the - /// user. - /// The ordered list - /// of artifact resource IDs that should be applied on all Windows VM - /// creations by default, prior to the artifacts specified by the - /// user. /// The setting to enable usage of /// premium data disks. /// When its value is 'Enabled', creation of standard or premium data /// disks is allowed. /// When its value is 'Disabled', only creation of standard data disks /// is allowed. Possible values include: 'Disabled', 'Enabled' - /// The access rights to be granted - /// to the user when provisioning an environment. Possible values - /// include: 'Reader', 'Contributor' - /// The properties of any lab announcement - /// associated with this lab - /// The properties of any lab support message - /// associated with this lab - /// Extended properties of the lab - /// used for experimental features - public LabFragment(IDictionary tags = default(IDictionary), string labStorageType = default(string), IList mandatoryArtifactsResourceIdsLinux = default(IList), IList mandatoryArtifactsResourceIdsWindows = default(IList), string premiumDataDisks = default(string), string environmentPermission = default(string), LabAnnouncementPropertiesFragment announcement = default(LabAnnouncementPropertiesFragment), LabSupportPropertiesFragment support = default(LabSupportPropertiesFragment), IDictionary extendedProperties = default(IDictionary)) - : base(tags) + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public LabFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string labStorageType = default(string), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) { LabStorageType = labStorageType; - MandatoryArtifactsResourceIdsLinux = mandatoryArtifactsResourceIdsLinux; - MandatoryArtifactsResourceIdsWindows = mandatoryArtifactsResourceIdsWindows; PremiumDataDisks = premiumDataDisks; - EnvironmentPermission = environmentPermission; - Announcement = announcement; - Support = support; - ExtendedProperties = extendedProperties; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -88,22 +75,6 @@ public LabFragment() [JsonProperty(PropertyName = "properties.labStorageType")] public string LabStorageType { get; set; } - /// - /// Gets or sets the ordered list of artifact resource IDs that should - /// be applied on all Linux VM creations by default, prior to the - /// artifacts specified by the user. - /// - [JsonProperty(PropertyName = "properties.mandatoryArtifactsResourceIdsLinux")] - public IList MandatoryArtifactsResourceIdsLinux { get; set; } - - /// - /// Gets or sets the ordered list of artifact resource IDs that should - /// be applied on all Windows VM creations by default, prior to the - /// artifacts specified by the user. - /// - [JsonProperty(PropertyName = "properties.mandatoryArtifactsResourceIdsWindows")] - public IList MandatoryArtifactsResourceIdsWindows { get; set; } - /// /// Gets or sets the setting to enable usage of premium data disks. /// When its value is 'Enabled', creation of standard or premium data @@ -115,33 +86,16 @@ public LabFragment() public string PremiumDataDisks { get; set; } /// - /// Gets or sets the access rights to be granted to the user when - /// provisioning an environment. Possible values include: 'Reader', - /// 'Contributor' - /// - [JsonProperty(PropertyName = "properties.environmentPermission")] - public string EnvironmentPermission { get; set; } - - /// - /// Gets or sets the properties of any lab announcement associated with - /// this lab - /// - [JsonProperty(PropertyName = "properties.announcement")] - public LabAnnouncementPropertiesFragment Announcement { get; set; } - - /// - /// Gets or sets the properties of any lab support message associated - /// with this lab + /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.support")] - public LabSupportPropertiesFragment Support { get; set; } + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } /// - /// Gets or sets extended properties of the lab used for experimental - /// features + /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.extendedProperties")] - public IDictionary ExtendedProperties { get; set; } + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportProperties.cs deleted file mode 100644 index b142870f138a..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportProperties.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties of a lab's support banner - /// - public partial class LabSupportProperties - { - /// - /// Initializes a new instance of the LabSupportProperties class. - /// - public LabSupportProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LabSupportProperties class. - /// - /// Is the lab support banner active/enabled at - /// this time?. Possible values include: 'Enabled', 'Disabled' - /// The markdown text (if any) that this lab - /// displays in the UI. If left empty/null, nothing will be - /// shown. - public LabSupportProperties(string enabled = default(string), string markdown = default(string)) - { - Enabled = enabled; - Markdown = markdown; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets is the lab support banner active/enabled at this - /// time?. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "enabled")] - public string Enabled { get; set; } - - /// - /// Gets or sets the markdown text (if any) that this lab displays in - /// the UI. If left empty/null, nothing will be shown. - /// - [JsonProperty(PropertyName = "markdown")] - public string Markdown { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportPropertiesFragment.cs deleted file mode 100644 index 18cd11c963b8..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabSupportPropertiesFragment.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties of a lab's support banner - /// - public partial class LabSupportPropertiesFragment - { - /// - /// Initializes a new instance of the LabSupportPropertiesFragment - /// class. - /// - public LabSupportPropertiesFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LabSupportPropertiesFragment - /// class. - /// - /// Is the lab support banner active/enabled at - /// this time?. Possible values include: 'Enabled', 'Disabled' - /// The markdown text (if any) that this lab - /// displays in the UI. If left empty/null, nothing will be - /// shown. - public LabSupportPropertiesFragment(string enabled = default(string), string markdown = default(string)) - { - Enabled = enabled; - Markdown = markdown; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets is the lab support banner active/enabled at this - /// time?. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "enabled")] - public string Enabled { get; set; } - - /// - /// Gets or sets the markdown text (if any) that this lab displays in - /// the UI. If left empty/null, nothing will be shown. - /// - [JsonProperty(PropertyName = "markdown")] - public string Markdown { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs index e6525bc4f840..1508160c0869 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs @@ -78,8 +78,6 @@ public LabVirtualMachine() /// status for the virtual machine. /// The Microsoft Azure Marketplace /// image reference of the virtual machine. - /// The id of the plan associated with the virtual - /// machine image /// The compute virtual machine /// properties. /// The network interface @@ -96,17 +94,11 @@ public LabVirtualMachine() /// include: 'FromCustomImage', 'FromGalleryImage' /// The resource ID of the environment that /// contains this virtual machine, if any. - /// New or existing data disks to - /// attach to the virtual machine after creation - /// Virtual Machine schedules to be - /// created - /// Last known compute power state - /// captured in DTL /// The provisioning status of the /// resource. /// The unique immutable identifier of a /// resource (Guid). - public LabVirtualMachine(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), string planId = default(string), ComputeVmProperties computeVm = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), IList dataDiskParameters = default(IList), IList scheduleParameters = default(IList), string lastKnownPowerState = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + public LabVirtualMachine(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVm = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) : base(id, name, type, location, tags) { Notes = notes; @@ -130,7 +122,6 @@ public LabVirtualMachine() Artifacts = artifacts; ArtifactDeploymentStatus = artifactDeploymentStatus; GalleryImageReference = galleryImageReference; - PlanId = planId; ComputeVm = computeVm; NetworkInterface = networkInterface; ApplicableSchedule = applicableSchedule; @@ -139,9 +130,6 @@ public LabVirtualMachine() StorageType = storageType; VirtualMachineCreationSource = virtualMachineCreationSource; EnvironmentId = environmentId; - DataDiskParameters = dataDiskParameters; - ScheduleParameters = scheduleParameters; - LastKnownPowerState = lastKnownPowerState; ProvisioningState = provisioningState; UniqueIdentifier = uniqueIdentifier; CustomInit(); @@ -191,11 +179,11 @@ public LabVirtualMachine() public System.DateTime? CreatedDate { get; set; } /// - /// Gets or sets the resource identifier (Microsoft.Compute) of the - /// virtual machine. + /// Gets the resource identifier (Microsoft.Compute) of the virtual + /// machine. /// [JsonProperty(PropertyName = "properties.computeId")] - public string ComputeId { get; set; } + public string ComputeId { get; private set; } /// /// Gets or sets the custom image identifier of the virtual machine. @@ -288,17 +276,10 @@ public LabVirtualMachine() public GalleryImageReference GalleryImageReference { get; set; } /// - /// Gets or sets the id of the plan associated with the virtual machine - /// image - /// - [JsonProperty(PropertyName = "properties.planId")] - public string PlanId { get; set; } - - /// - /// Gets the compute virtual machine properties. + /// Gets or sets the compute virtual machine properties. /// [JsonProperty(PropertyName = "properties.computeVm")] - public ComputeVmProperties ComputeVm { get; private set; } + public ComputeVmProperties ComputeVm { get; set; } /// /// Gets or sets the network interface properties. @@ -307,10 +288,10 @@ public LabVirtualMachine() public NetworkInterfaceProperties NetworkInterface { get; set; } /// - /// Gets the applicable schedule for the virtual machine. + /// Gets or sets the applicable schedule for the virtual machine. /// [JsonProperty(PropertyName = "properties.applicableSchedule")] - public ApplicableSchedule ApplicableSchedule { get; private set; } + public ApplicableSchedule ApplicableSchedule { get; set; } /// /// Gets or sets the expiration date for VM. @@ -348,35 +329,16 @@ public LabVirtualMachine() public string EnvironmentId { get; set; } /// - /// Gets or sets new or existing data disks to attach to the virtual - /// machine after creation - /// - [JsonProperty(PropertyName = "properties.dataDiskParameters")] - public IList DataDiskParameters { get; set; } - - /// - /// Gets or sets virtual Machine schedules to be created - /// - [JsonProperty(PropertyName = "properties.scheduleParameters")] - public IList ScheduleParameters { get; set; } - - /// - /// Gets or sets last known compute power state captured in DTL - /// - [JsonProperty(PropertyName = "properties.lastKnownPowerState")] - public string LastKnownPowerState { get; set; } - - /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs index 3ff647fd5600..0203eeee9632 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs @@ -49,8 +49,6 @@ public LabVirtualMachineCreationParameter() /// virtual machine. /// The creation date of the virtual /// machine. - /// The resource identifier (Microsoft.Compute) - /// of the virtual machine. /// The custom image identifier of the /// virtual machine. /// The OS type of the virtual machine. @@ -77,10 +75,12 @@ public LabVirtualMachineCreationParameter() /// status for the virtual machine. /// The Microsoft Azure Marketplace /// image reference of the virtual machine. - /// The id of the plan associated with the virtual - /// machine image + /// The compute virtual machine + /// properties. /// The network interface /// properties. + /// The applicable schedule for the + /// virtual machine. /// The expiration date for VM. /// Indicates whether another user can take /// ownership of the virtual machine @@ -91,18 +91,16 @@ public LabVirtualMachineCreationParameter() /// include: 'FromCustomImage', 'FromGalleryImage' /// The resource ID of the environment that /// contains this virtual machine, if any. - /// New or existing data disks to - /// attach to the virtual machine after creation - /// Virtual Machine schedules to be - /// created - /// Last known compute power state - /// captured in DTL + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). /// The name of the virtual machine or /// environment /// The location of the new virtual machine or /// environment /// The tags of the resource. - public LabVirtualMachineCreationParameter(BulkCreationParameters bulkCreationParameters = default(BulkCreationParameters), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), string planId = default(string), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), IList dataDiskParameters = default(IList), IList scheduleParameters = default(IList), string lastKnownPowerState = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + public LabVirtualMachineCreationParameter(BulkCreationParameters bulkCreationParameters = default(BulkCreationParameters), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVm = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { BulkCreationParameters = bulkCreationParameters; Notes = notes; @@ -111,7 +109,6 @@ public LabVirtualMachineCreationParameter() CreatedByUserId = createdByUserId; CreatedByUser = createdByUser; CreatedDate = createdDate; - ComputeId = computeId; CustomImageId = customImageId; OsType = osType; Size = size; @@ -126,16 +123,16 @@ public LabVirtualMachineCreationParameter() Artifacts = artifacts; ArtifactDeploymentStatus = artifactDeploymentStatus; GalleryImageReference = galleryImageReference; - PlanId = planId; + ComputeVm = computeVm; NetworkInterface = networkInterface; + ApplicableSchedule = applicableSchedule; ExpirationDate = expirationDate; AllowClaim = allowClaim; StorageType = storageType; VirtualMachineCreationSource = virtualMachineCreationSource; EnvironmentId = environmentId; - DataDiskParameters = dataDiskParameters; - ScheduleParameters = scheduleParameters; - LastKnownPowerState = lastKnownPowerState; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; Name = name; Location = location; Tags = tags; @@ -191,13 +188,6 @@ public LabVirtualMachineCreationParameter() [JsonProperty(PropertyName = "properties.createdDate")] public System.DateTime? CreatedDate { get; set; } - /// - /// Gets or sets the resource identifier (Microsoft.Compute) of the - /// virtual machine. - /// - [JsonProperty(PropertyName = "properties.computeId")] - public string ComputeId { get; set; } - /// /// Gets or sets the custom image identifier of the virtual machine. /// @@ -289,11 +279,10 @@ public LabVirtualMachineCreationParameter() public GalleryImageReference GalleryImageReference { get; set; } /// - /// Gets or sets the id of the plan associated with the virtual machine - /// image + /// Gets or sets the compute virtual machine properties. /// - [JsonProperty(PropertyName = "properties.planId")] - public string PlanId { get; set; } + [JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmProperties ComputeVm { get; set; } /// /// Gets or sets the network interface properties. @@ -301,6 +290,12 @@ public LabVirtualMachineCreationParameter() [JsonProperty(PropertyName = "properties.networkInterface")] public NetworkInterfaceProperties NetworkInterface { get; set; } + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableSchedule ApplicableSchedule { get; set; } + /// /// Gets or sets the expiration date for VM. /// @@ -337,23 +332,16 @@ public LabVirtualMachineCreationParameter() public string EnvironmentId { get; set; } /// - /// Gets or sets new or existing data disks to attach to the virtual - /// machine after creation - /// - [JsonProperty(PropertyName = "properties.dataDiskParameters")] - public IList DataDiskParameters { get; set; } - - /// - /// Gets or sets virtual Machine schedules to be created + /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.scheduleParameters")] - public IList ScheduleParameters { get; set; } + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } /// - /// Gets or sets last known compute power state captured in DTL + /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.lastKnownPowerState")] - public string LastKnownPowerState { get; set; } + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } /// /// Gets or sets the name of the virtual machine or environment diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterFragment.cs deleted file mode 100644 index df4407baf182..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterFragment.cs +++ /dev/null @@ -1,377 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Properties for creating a virtual machine. - /// - [Rest.Serialization.JsonTransformation] - public partial class LabVirtualMachineCreationParameterFragment - { - /// - /// Initializes a new instance of the - /// LabVirtualMachineCreationParameterFragment class. - /// - public LabVirtualMachineCreationParameterFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// LabVirtualMachineCreationParameterFragment class. - /// - /// The number of virtual machine - /// instances to create. - /// The notes of the virtual machine. - /// The object identifier of the owner of - /// the virtual machine. - /// The user principal name of the - /// virtual machine owner. - /// The object identifier of the creator - /// of the virtual machine. - /// The email address of creator of the - /// virtual machine. - /// The creation date of the virtual - /// machine. - /// The resource identifier (Microsoft.Compute) - /// of the virtual machine. - /// The custom image identifier of the - /// virtual machine. - /// The OS type of the virtual machine. - /// The size of the virtual machine. - /// The user name of the virtual - /// machine. - /// The password of the virtual machine - /// administrator. - /// The SSH key of the virtual machine - /// administrator. - /// Indicates whether this - /// virtual machine uses an SSH key for authentication. - /// The fully-qualified domain name of the virtual - /// machine. - /// The lab subnet name of the virtual - /// machine. - /// The lab virtual network - /// identifier of the virtual machine. - /// Indicates whether the virtual - /// machine is to be created without a public IP address. - /// The artifacts to be installed on the - /// virtual machine. - /// The artifact deployment - /// status for the virtual machine. - /// The Microsoft Azure Marketplace - /// image reference of the virtual machine. - /// The id of the plan associated with the virtual - /// machine image - /// The network interface - /// properties. - /// The expiration date for VM. - /// Indicates whether another user can take - /// ownership of the virtual machine - /// Storage type to use for virtual machine - /// (i.e. Standard, Premium). - /// Tells source of creation - /// of lab virtual machine. Output property only. Possible values - /// include: 'FromCustomImage', 'FromGalleryImage' - /// The resource ID of the environment that - /// contains this virtual machine, if any. - /// New or existing data disks to - /// attach to the virtual machine after creation - /// Virtual Machine schedules to be - /// created - /// Last known compute power state - /// captured in DTL - /// The name of the virtual machine or - /// environment - /// The location of the new virtual machine or - /// environment - /// The tags of the resource. - public LabVirtualMachineCreationParameterFragment(BulkCreationParametersFragment bulkCreationParameters = default(BulkCreationParametersFragment), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), string planId = default(string), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), IList dataDiskParameters = default(IList), IList scheduleParameters = default(IList), string lastKnownPowerState = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) - { - BulkCreationParameters = bulkCreationParameters; - Notes = notes; - OwnerObjectId = ownerObjectId; - OwnerUserPrincipalName = ownerUserPrincipalName; - CreatedByUserId = createdByUserId; - CreatedByUser = createdByUser; - CreatedDate = createdDate; - ComputeId = computeId; - CustomImageId = customImageId; - OsType = osType; - Size = size; - UserName = userName; - Password = password; - SshKey = sshKey; - IsAuthenticationWithSshKey = isAuthenticationWithSshKey; - Fqdn = fqdn; - LabSubnetName = labSubnetName; - LabVirtualNetworkId = labVirtualNetworkId; - DisallowPublicIpAddress = disallowPublicIpAddress; - Artifacts = artifacts; - ArtifactDeploymentStatus = artifactDeploymentStatus; - GalleryImageReference = galleryImageReference; - PlanId = planId; - NetworkInterface = networkInterface; - ExpirationDate = expirationDate; - AllowClaim = allowClaim; - StorageType = storageType; - VirtualMachineCreationSource = virtualMachineCreationSource; - EnvironmentId = environmentId; - DataDiskParameters = dataDiskParameters; - ScheduleParameters = scheduleParameters; - LastKnownPowerState = lastKnownPowerState; - Name = name; - Location = location; - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the number of virtual machine instances to create. - /// - [JsonProperty(PropertyName = "properties.bulkCreationParameters")] - public BulkCreationParametersFragment BulkCreationParameters { get; set; } - - /// - /// Gets or sets the notes of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.notes")] - public string Notes { get; set; } - - /// - /// Gets or sets the object identifier of the owner of the virtual - /// machine. - /// - [JsonProperty(PropertyName = "properties.ownerObjectId")] - public string OwnerObjectId { get; set; } - - /// - /// Gets or sets the user principal name of the virtual machine owner. - /// - [JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] - public string OwnerUserPrincipalName { get; set; } - - /// - /// Gets or sets the object identifier of the creator of the virtual - /// machine. - /// - [JsonProperty(PropertyName = "properties.createdByUserId")] - public string CreatedByUserId { get; set; } - - /// - /// Gets or sets the email address of creator of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.createdByUser")] - public string CreatedByUser { get; set; } - - /// - /// Gets or sets the creation date of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; set; } - - /// - /// Gets or sets the resource identifier (Microsoft.Compute) of the - /// virtual machine. - /// - [JsonProperty(PropertyName = "properties.computeId")] - public string ComputeId { get; set; } - - /// - /// Gets or sets the custom image identifier of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.customImageId")] - public string CustomImageId { get; set; } - - /// - /// Gets or sets the OS type of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.osType")] - public string OsType { get; set; } - - /// - /// Gets or sets the size of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.size")] - public string Size { get; set; } - - /// - /// Gets or sets the user name of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.userName")] - public string UserName { get; set; } - - /// - /// Gets or sets the password of the virtual machine administrator. - /// - [JsonProperty(PropertyName = "properties.password")] - public string Password { get; set; } - - /// - /// Gets or sets the SSH key of the virtual machine administrator. - /// - [JsonProperty(PropertyName = "properties.sshKey")] - public string SshKey { get; set; } - - /// - /// Gets or sets indicates whether this virtual machine uses an SSH key - /// for authentication. - /// - [JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] - public bool? IsAuthenticationWithSshKey { get; set; } - - /// - /// Gets or sets the fully-qualified domain name of the virtual - /// machine. - /// - [JsonProperty(PropertyName = "properties.fqdn")] - public string Fqdn { get; set; } - - /// - /// Gets or sets the lab subnet name of the virtual machine. - /// - [JsonProperty(PropertyName = "properties.labSubnetName")] - public string LabSubnetName { get; set; } - - /// - /// Gets or sets the lab virtual network identifier of the virtual - /// machine. - /// - [JsonProperty(PropertyName = "properties.labVirtualNetworkId")] - public string LabVirtualNetworkId { get; set; } - - /// - /// Gets or sets indicates whether the virtual machine is to be created - /// without a public IP address. - /// - [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] - public bool? DisallowPublicIpAddress { get; set; } - - /// - /// Gets or sets the artifacts to be installed on the virtual machine. - /// - [JsonProperty(PropertyName = "properties.artifacts")] - public IList Artifacts { get; set; } - - /// - /// Gets or sets the artifact deployment status for the virtual - /// machine. - /// - [JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] - public ArtifactDeploymentStatusPropertiesFragment ArtifactDeploymentStatus { get; set; } - - /// - /// Gets or sets the Microsoft Azure Marketplace image reference of the - /// virtual machine. - /// - [JsonProperty(PropertyName = "properties.galleryImageReference")] - public GalleryImageReferenceFragment GalleryImageReference { get; set; } - - /// - /// Gets or sets the id of the plan associated with the virtual machine - /// image - /// - [JsonProperty(PropertyName = "properties.planId")] - public string PlanId { get; set; } - - /// - /// Gets or sets the network interface properties. - /// - [JsonProperty(PropertyName = "properties.networkInterface")] - public NetworkInterfacePropertiesFragment NetworkInterface { get; set; } - - /// - /// Gets or sets the expiration date for VM. - /// - [JsonProperty(PropertyName = "properties.expirationDate")] - public System.DateTime? ExpirationDate { get; set; } - - /// - /// Gets or sets indicates whether another user can take ownership of - /// the virtual machine - /// - [JsonProperty(PropertyName = "properties.allowClaim")] - public bool? AllowClaim { get; set; } - - /// - /// Gets or sets storage type to use for virtual machine (i.e. - /// Standard, Premium). - /// - [JsonProperty(PropertyName = "properties.storageType")] - public string StorageType { get; set; } - - /// - /// Gets or sets tells source of creation of lab virtual machine. - /// Output property only. Possible values include: 'FromCustomImage', - /// 'FromGalleryImage' - /// - [JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] - public string VirtualMachineCreationSource { get; set; } - - /// - /// Gets or sets the resource ID of the environment that contains this - /// virtual machine, if any. - /// - [JsonProperty(PropertyName = "properties.environmentId")] - public string EnvironmentId { get; set; } - - /// - /// Gets or sets new or existing data disks to attach to the virtual - /// machine after creation - /// - [JsonProperty(PropertyName = "properties.dataDiskParameters")] - public IList DataDiskParameters { get; set; } - - /// - /// Gets or sets virtual Machine schedules to be created - /// - [JsonProperty(PropertyName = "properties.scheduleParameters")] - public IList ScheduleParameters { get; set; } - - /// - /// Gets or sets last known compute power state captured in DTL - /// - [JsonProperty(PropertyName = "properties.lastKnownPowerState")] - public string LastKnownPowerState { get; set; } - - /// - /// Gets or sets the name of the virtual machine or environment - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the location of the new virtual machine or environment - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the tags of the resource. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs index b76a4e63da3b..992cbff8c67b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// A virtual machine. /// [Rest.Serialization.JsonTransformation] - public partial class LabVirtualMachineFragment : UpdateResource + public partial class LabVirtualMachineFragment : Resource { /// /// Initializes a new instance of the LabVirtualMachineFragment class. @@ -34,6 +34,10 @@ public LabVirtualMachineFragment() /// /// Initializes a new instance of the LabVirtualMachineFragment class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// The notes of the virtual machine. /// The object identifier of the owner of @@ -46,8 +50,6 @@ public LabVirtualMachineFragment() /// virtual machine. /// The creation date of the virtual /// machine. - /// The resource identifier (Microsoft.Compute) - /// of the virtual machine. /// The custom image identifier of the /// virtual machine. /// The OS type of the virtual machine. @@ -74,10 +76,12 @@ public LabVirtualMachineFragment() /// status for the virtual machine. /// The Microsoft Azure Marketplace /// image reference of the virtual machine. - /// The id of the plan associated with the virtual - /// machine image + /// The compute virtual machine + /// properties. /// The network interface /// properties. + /// The applicable schedule for the + /// virtual machine. /// The expiration date for VM. /// Indicates whether another user can take /// ownership of the virtual machine @@ -88,14 +92,12 @@ public LabVirtualMachineFragment() /// include: 'FromCustomImage', 'FromGalleryImage' /// The resource ID of the environment that /// contains this virtual machine, if any. - /// New or existing data disks to - /// attach to the virtual machine after creation - /// Virtual Machine schedules to be - /// created - /// Last known compute power state - /// captured in DTL - public LabVirtualMachineFragment(IDictionary tags = default(IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), string planId = default(string), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), IList dataDiskParameters = default(IList), IList scheduleParameters = default(IList), string lastKnownPowerState = default(string)) - : base(tags) + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public LabVirtualMachineFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), ComputeVmPropertiesFragment computeVm = default(ComputeVmPropertiesFragment), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), ApplicableScheduleFragment applicableSchedule = default(ApplicableScheduleFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) { Notes = notes; OwnerObjectId = ownerObjectId; @@ -103,7 +105,6 @@ public LabVirtualMachineFragment() CreatedByUserId = createdByUserId; CreatedByUser = createdByUser; CreatedDate = createdDate; - ComputeId = computeId; CustomImageId = customImageId; OsType = osType; Size = size; @@ -118,16 +119,16 @@ public LabVirtualMachineFragment() Artifacts = artifacts; ArtifactDeploymentStatus = artifactDeploymentStatus; GalleryImageReference = galleryImageReference; - PlanId = planId; + ComputeVm = computeVm; NetworkInterface = networkInterface; + ApplicableSchedule = applicableSchedule; ExpirationDate = expirationDate; AllowClaim = allowClaim; StorageType = storageType; VirtualMachineCreationSource = virtualMachineCreationSource; EnvironmentId = environmentId; - DataDiskParameters = dataDiskParameters; - ScheduleParameters = scheduleParameters; - LastKnownPowerState = lastKnownPowerState; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -174,13 +175,6 @@ public LabVirtualMachineFragment() [JsonProperty(PropertyName = "properties.createdDate")] public System.DateTime? CreatedDate { get; set; } - /// - /// Gets or sets the resource identifier (Microsoft.Compute) of the - /// virtual machine. - /// - [JsonProperty(PropertyName = "properties.computeId")] - public string ComputeId { get; set; } - /// /// Gets or sets the custom image identifier of the virtual machine. /// @@ -272,11 +266,10 @@ public LabVirtualMachineFragment() public GalleryImageReferenceFragment GalleryImageReference { get; set; } /// - /// Gets or sets the id of the plan associated with the virtual machine - /// image + /// Gets or sets the compute virtual machine properties. /// - [JsonProperty(PropertyName = "properties.planId")] - public string PlanId { get; set; } + [JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmPropertiesFragment ComputeVm { get; set; } /// /// Gets or sets the network interface properties. @@ -284,6 +277,12 @@ public LabVirtualMachineFragment() [JsonProperty(PropertyName = "properties.networkInterface")] public NetworkInterfacePropertiesFragment NetworkInterface { get; set; } + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableScheduleFragment ApplicableSchedule { get; set; } + /// /// Gets or sets the expiration date for VM. /// @@ -320,23 +319,16 @@ public LabVirtualMachineFragment() public string EnvironmentId { get; set; } /// - /// Gets or sets new or existing data disks to attach to the virtual - /// machine after creation - /// - [JsonProperty(PropertyName = "properties.dataDiskParameters")] - public IList DataDiskParameters { get; set; } - - /// - /// Gets or sets virtual Machine schedules to be created + /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.scheduleParameters")] - public IList ScheduleParameters { get; set; } + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } /// - /// Gets or sets last known compute power state captured in DTL + /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.lastKnownPowerState")] - public string LastKnownPowerState { get; set; } + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfoFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfoFragment.cs deleted file mode 100644 index fdd6ba5aba99..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfoFragment.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Information about a Linux OS. - /// - public partial class LinuxOsInfoFragment - { - /// - /// Initializes a new instance of the LinuxOsInfoFragment class. - /// - public LinuxOsInfoFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LinuxOsInfoFragment class. - /// - /// The state of the Linux OS (i.e. - /// NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). - /// Possible values include: 'NonDeprovisioned', - /// 'DeprovisionRequested', 'DeprovisionApplied' - public LinuxOsInfoFragment(string linuxOsState = default(string)) - { - LinuxOsState = linuxOsState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the state of the Linux OS (i.e. NonDeprovisioned, - /// DeprovisionRequested, DeprovisionApplied). Possible values include: - /// 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' - /// - [JsonProperty(PropertyName = "linuxOsState")] - public string LinuxOsState { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs index 99644eb038a2..17ac4b8e5798 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs @@ -41,11 +41,6 @@ public NotificationChannel() /// The tags of the resource. /// The webhook URL to send notifications /// to. - /// The email recipient to send - /// notifications to (can be a list of semi-colon seperated email - /// addresses). - /// The locale to use when sending a - /// notification (fallback for unsupported languages is EN). /// Description of notification. /// The list of event for which this notification /// is enabled. @@ -55,12 +50,10 @@ public NotificationChannel() /// resource. /// The unique immutable identifier of a /// resource (Guid). - public NotificationChannel(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string webHookUrl = default(string), string emailRecipient = default(string), string notificationLocale = default(string), string description = default(string), IList events = default(IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + public NotificationChannel(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string webHookUrl = default(string), string description = default(string), IList events = default(IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) : base(id, name, type, location, tags) { WebHookUrl = webHookUrl; - EmailRecipient = emailRecipient; - NotificationLocale = notificationLocale; Description = description; Events = events; CreatedDate = createdDate; @@ -80,20 +73,6 @@ public NotificationChannel() [JsonProperty(PropertyName = "properties.webHookUrl")] public string WebHookUrl { get; set; } - /// - /// Gets or sets the email recipient to send notifications to (can be a - /// list of semi-colon seperated email addresses). - /// - [JsonProperty(PropertyName = "properties.emailRecipient")] - public string EmailRecipient { get; set; } - - /// - /// Gets or sets the locale to use when sending a notification - /// (fallback for unsupported languages is EN). - /// - [JsonProperty(PropertyName = "properties.notificationLocale")] - public string NotificationLocale { get; set; } - /// /// Gets or sets description of notification. /// @@ -114,16 +93,16 @@ public NotificationChannel() public System.DateTime? CreatedDate { get; private set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs index c5b9f4b87259..2e9cc702278c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// A notification. /// [Rest.Serialization.JsonTransformation] - public partial class NotificationChannelFragment : UpdateResource + public partial class NotificationChannelFragment : Resource { /// /// Initializes a new instance of the NotificationChannelFragment @@ -36,25 +36,28 @@ public NotificationChannelFragment() /// Initializes a new instance of the NotificationChannelFragment /// class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// The webhook URL to send notifications /// to. - /// The email recipient to send - /// notifications to (can be a list of semi-colon seperated email - /// addresses). - /// The locale to use when sending a - /// notification (fallback for unsupported languages is EN). /// Description of notification. /// The list of event for which this notification /// is enabled. - public NotificationChannelFragment(IDictionary tags = default(IDictionary), string webHookUrl = default(string), string emailRecipient = default(string), string notificationLocale = default(string), string description = default(string), IList events = default(IList)) - : base(tags) + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public NotificationChannelFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string webHookUrl = default(string), string description = default(string), IList events = default(IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) { WebHookUrl = webHookUrl; - EmailRecipient = emailRecipient; - NotificationLocale = notificationLocale; Description = description; Events = events; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -69,20 +72,6 @@ public NotificationChannelFragment() [JsonProperty(PropertyName = "properties.webHookUrl")] public string WebHookUrl { get; set; } - /// - /// Gets or sets the email recipient to send notifications to (can be a - /// list of semi-colon seperated email addresses). - /// - [JsonProperty(PropertyName = "properties.emailRecipient")] - public string EmailRecipient { get; set; } - - /// - /// Gets or sets the locale to use when sending a notification - /// (fallback for unsupported languages is EN). - /// - [JsonProperty(PropertyName = "properties.notificationLocale")] - public string NotificationLocale { get; set; } - /// /// Gets or sets description of notification. /// @@ -96,5 +85,17 @@ public NotificationChannelFragment() [JsonProperty(PropertyName = "properties.events")] public IList Events { get; set; } + /// + /// Gets or sets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } + } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs index cdc145cc5a1b..0f278caec20e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs @@ -30,24 +30,17 @@ public NotificationSettings() /// Initializes a new instance of the NotificationSettings class. /// /// If notifications are enabled for this schedule - /// (i.e. Enabled, Disabled). Possible values include: 'Enabled', - /// 'Disabled' + /// (i.e. Enabled, Disabled). Possible values include: 'Disabled', + /// 'Enabled' /// Time in minutes before event at which /// notification will be sent. /// The webhook URL to which the notification /// will be sent. - /// The email recipient to send - /// notifications to (can be a list of semi-colon seperated email - /// addresses). - /// The locale to use when sending a - /// notification (fallback for unsupported languages is EN). - public NotificationSettings(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string), string emailRecipient = default(string), string notificationLocale = default(string)) + public NotificationSettings(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string)) { Status = status; TimeInMinutes = timeInMinutes; WebhookUrl = webhookUrl; - EmailRecipient = emailRecipient; - NotificationLocale = notificationLocale; CustomInit(); } @@ -58,7 +51,7 @@ public NotificationSettings() /// /// Gets or sets if notifications are enabled for this schedule (i.e. - /// Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + /// Enabled, Disabled). Possible values include: 'Disabled', 'Enabled' /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } @@ -77,19 +70,5 @@ public NotificationSettings() [JsonProperty(PropertyName = "webhookUrl")] public string WebhookUrl { get; set; } - /// - /// Gets or sets the email recipient to send notifications to (can be a - /// list of semi-colon seperated email addresses). - /// - [JsonProperty(PropertyName = "emailRecipient")] - public string EmailRecipient { get; set; } - - /// - /// Gets or sets the locale to use when sending a notification - /// (fallback for unsupported languages is EN). - /// - [JsonProperty(PropertyName = "notificationLocale")] - public string NotificationLocale { get; set; } - } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs index eaae0283bef2..e99c931288ce 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs @@ -32,24 +32,17 @@ public NotificationSettingsFragment() /// class. /// /// If notifications are enabled for this schedule - /// (i.e. Enabled, Disabled). Possible values include: 'Enabled', - /// 'Disabled' + /// (i.e. Enabled, Disabled). Possible values include: 'Disabled', + /// 'Enabled' /// Time in minutes before event at which /// notification will be sent. /// The webhook URL to which the notification /// will be sent. - /// The email recipient to send - /// notifications to (can be a list of semi-colon seperated email - /// addresses). - /// The locale to use when sending a - /// notification (fallback for unsupported languages is EN). - public NotificationSettingsFragment(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string), string emailRecipient = default(string), string notificationLocale = default(string)) + public NotificationSettingsFragment(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string)) { Status = status; TimeInMinutes = timeInMinutes; WebhookUrl = webhookUrl; - EmailRecipient = emailRecipient; - NotificationLocale = notificationLocale; CustomInit(); } @@ -60,7 +53,7 @@ public NotificationSettingsFragment() /// /// Gets or sets if notifications are enabled for this schedule (i.e. - /// Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + /// Enabled, Disabled). Possible values include: 'Disabled', 'Enabled' /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } @@ -79,19 +72,5 @@ public NotificationSettingsFragment() [JsonProperty(PropertyName = "webhookUrl")] public string WebhookUrl { get; set; } - /// - /// Gets or sets the email recipient to send notifications to (can be a - /// list of semi-colon seperated email addresses). - /// - [JsonProperty(PropertyName = "emailRecipient")] - public string EmailRecipient { get; set; } - - /// - /// Gets or sets the locale to use when sending a notification - /// (fallback for unsupported languages is EN). - /// - [JsonProperty(PropertyName = "notificationLocale")] - public string NotificationLocale { get; set; } - } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentPermission.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs similarity index 69% rename from src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentPermission.cs rename to src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs index cb17c329d50e..ca1802b8d9aa 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentPermission.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs @@ -12,11 +12,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models { /// - /// Defines values for EnvironmentPermission. + /// Defines values for NotificationStatus. /// - public static class EnvironmentPermission + public static class NotificationStatus { - public const string Reader = "Reader"; - public const string Contributor = "Contributor"; + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs index bb50ec14a072..f7b7d259d107 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs @@ -46,8 +46,7 @@ public Policy() /// LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values /// include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', /// 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', - /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost', - /// 'EnvironmentTemplate', 'ScheduleEditPermission' + /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' /// The fact data of the policy. /// The threshold of the policy (i.e. a number /// for MaxValuePolicy, and a JSON array of values for @@ -98,8 +97,7 @@ public Policy() /// LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: /// 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', /// 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', - /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost', - /// 'EnvironmentTemplate', 'ScheduleEditPermission' + /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' /// [JsonProperty(PropertyName = "properties.factName")] public string FactName { get; set; } @@ -133,16 +131,16 @@ public Policy() public System.DateTime? CreatedDate { get; private set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs index fea7e30b6e61..6c528e2d86f2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs @@ -24,7 +24,5 @@ public static class PolicyFactName public const string GalleryImage = "GalleryImage"; public const string UserOwnedLabVmCountInSubnet = "UserOwnedLabVmCountInSubnet"; public const string LabTargetCost = "LabTargetCost"; - public const string EnvironmentTemplate = "EnvironmentTemplate"; - public const string ScheduleEditPermission = "ScheduleEditPermission"; } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs index 020c1526165d..e70b9de2384c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// A Policy. /// [Rest.Serialization.JsonTransformation] - public partial class PolicyFragment : UpdateResource + public partial class PolicyFragment : Resource { /// /// Initializes a new instance of the PolicyFragment class. @@ -34,6 +34,10 @@ public PolicyFragment() /// /// Initializes a new instance of the PolicyFragment class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// The description of the policy. /// The status of the policy. Possible values @@ -42,8 +46,7 @@ public PolicyFragment() /// LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values /// include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', /// 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', - /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost', - /// 'EnvironmentTemplate', 'ScheduleEditPermission' + /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' /// The fact data of the policy. /// The threshold of the policy (i.e. a number /// for MaxValuePolicy, and a JSON array of values for @@ -51,8 +54,12 @@ public PolicyFragment() /// The evaluator type of the policy (i.e. /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: /// 'AllowedValuesPolicy', 'MaxValuePolicy' - public PolicyFragment(IDictionary tags = default(IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string)) - : base(tags) + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public PolicyFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) { Description = description; Status = status; @@ -60,6 +67,8 @@ public PolicyFragment() FactData = factData; Threshold = threshold; EvaluatorType = evaluatorType; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -86,8 +95,7 @@ public PolicyFragment() /// LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: /// 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', /// 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', - /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost', - /// 'EnvironmentTemplate', 'ScheduleEditPermission' + /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' /// [JsonProperty(PropertyName = "properties.factName")] public string FactName { get; set; } @@ -114,5 +122,17 @@ public PolicyFragment() [JsonProperty(PropertyName = "properties.evaluatorType")] public string EvaluatorType { get; set; } + /// + /// Gets or sets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } + } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RdpConnection.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RdpConnection.cs deleted file mode 100644 index 54b763facfe3..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RdpConnection.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a .rdp file - /// - public partial class RdpConnection - { - /// - /// Initializes a new instance of the RdpConnection class. - /// - public RdpConnection() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RdpConnection class. - /// - /// The contents of the .rdp file - public RdpConnection(string contents = default(string)) - { - Contents = contents; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the contents of the .rdp file - /// - [JsonProperty(PropertyName = "contents")] - public string Contents { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ResizeLabVirtualMachineProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ResizeLabVirtualMachineProperties.cs deleted file mode 100644 index 3cfe6de3c77b..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ResizeLabVirtualMachineProperties.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Request body for resizing a virtual machine. - /// - public partial class ResizeLabVirtualMachineProperties - { - /// - /// Initializes a new instance of the ResizeLabVirtualMachineProperties - /// class. - /// - public ResizeLabVirtualMachineProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResizeLabVirtualMachineProperties - /// class. - /// - /// Specifies the size of the virtual - /// machine. - public ResizeLabVirtualMachineProperties(string size = default(string)) - { - Size = size; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets specifies the size of the virtual machine. - /// - [JsonProperty(PropertyName = "size")] - public string Size { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs index 9fea2adcb9ac..dbf967b4cf3a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs @@ -142,16 +142,16 @@ public Schedule() public string TargetResourceId { get; set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameter.cs deleted file mode 100644 index d73b511d7111..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameter.cs +++ /dev/null @@ -1,150 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Properties for creating a schedule. - /// - [Rest.Serialization.JsonTransformation] - public partial class ScheduleCreationParameter - { - /// - /// Initializes a new instance of the ScheduleCreationParameter class. - /// - public ScheduleCreationParameter() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScheduleCreationParameter class. - /// - /// The status of the schedule (i.e. Enabled, - /// Disabled). Possible values include: 'Enabled', 'Disabled' - /// The task type of the schedule (e.g. - /// LabVmsShutdownTask, LabVmAutoStart). - /// If the schedule will occur only some - /// days of the week, specify the weekly recurrence. - /// If the schedule will occur once each - /// day of the week, specify the daily recurrence. - /// If the schedule will occur multiple - /// times a day, specify the hourly recurrence. - /// The time zone ID (e.g. Pacific Standard - /// time). - /// Notification settings. - /// The resource ID to which the - /// schedule belongs - /// The name of the virtual machine or - /// environment - /// The location of the new virtual machine or - /// environment - /// The tags of the resource. - public ScheduleCreationParameter(string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), NotificationSettings notificationSettings = default(NotificationSettings), string targetResourceId = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) - { - Status = status; - TaskType = taskType; - WeeklyRecurrence = weeklyRecurrence; - DailyRecurrence = dailyRecurrence; - HourlyRecurrence = hourlyRecurrence; - TimeZoneId = timeZoneId; - NotificationSettings = notificationSettings; - TargetResourceId = targetResourceId; - Name = name; - Location = location; - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the status of the schedule (i.e. Enabled, Disabled). - /// Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } - - /// - /// Gets or sets the task type of the schedule (e.g. - /// LabVmsShutdownTask, LabVmAutoStart). - /// - [JsonProperty(PropertyName = "properties.taskType")] - public string TaskType { get; set; } - - /// - /// Gets or sets if the schedule will occur only some days of the week, - /// specify the weekly recurrence. - /// - [JsonProperty(PropertyName = "properties.weeklyRecurrence")] - public WeekDetails WeeklyRecurrence { get; set; } - - /// - /// Gets or sets if the schedule will occur once each day of the week, - /// specify the daily recurrence. - /// - [JsonProperty(PropertyName = "properties.dailyRecurrence")] - public DayDetails DailyRecurrence { get; set; } - - /// - /// Gets or sets if the schedule will occur multiple times a day, - /// specify the hourly recurrence. - /// - [JsonProperty(PropertyName = "properties.hourlyRecurrence")] - public HourDetails HourlyRecurrence { get; set; } - - /// - /// Gets or sets the time zone ID (e.g. Pacific Standard time). - /// - [JsonProperty(PropertyName = "properties.timeZoneId")] - public string TimeZoneId { get; set; } - - /// - /// Gets or sets notification settings. - /// - [JsonProperty(PropertyName = "properties.notificationSettings")] - public NotificationSettings NotificationSettings { get; set; } - - /// - /// Gets or sets the resource ID to which the schedule belongs - /// - [JsonProperty(PropertyName = "properties.targetResourceId")] - public string TargetResourceId { get; set; } - - /// - /// Gets or sets the name of the virtual machine or environment - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the location of the new virtual machine or environment - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the tags of the resource. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameterFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameterFragment.cs deleted file mode 100644 index 1defb029e514..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleCreationParameterFragment.cs +++ /dev/null @@ -1,152 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Properties for creating a schedule. - /// - [Rest.Serialization.JsonTransformation] - public partial class ScheduleCreationParameterFragment - { - /// - /// Initializes a new instance of the ScheduleCreationParameterFragment - /// class. - /// - public ScheduleCreationParameterFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScheduleCreationParameterFragment - /// class. - /// - /// The status of the schedule (i.e. Enabled, - /// Disabled). Possible values include: 'Enabled', 'Disabled' - /// The task type of the schedule (e.g. - /// LabVmsShutdownTask, LabVmAutoStart). - /// If the schedule will occur only some - /// days of the week, specify the weekly recurrence. - /// If the schedule will occur once each - /// day of the week, specify the daily recurrence. - /// If the schedule will occur multiple - /// times a day, specify the hourly recurrence. - /// The time zone ID (e.g. Pacific Standard - /// time). - /// Notification settings. - /// The resource ID to which the - /// schedule belongs - /// The name of the virtual machine or - /// environment - /// The location of the new virtual machine or - /// environment - /// The tags of the resource. - public ScheduleCreationParameterFragment(string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) - { - Status = status; - TaskType = taskType; - WeeklyRecurrence = weeklyRecurrence; - DailyRecurrence = dailyRecurrence; - HourlyRecurrence = hourlyRecurrence; - TimeZoneId = timeZoneId; - NotificationSettings = notificationSettings; - TargetResourceId = targetResourceId; - Name = name; - Location = location; - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the status of the schedule (i.e. Enabled, Disabled). - /// Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } - - /// - /// Gets or sets the task type of the schedule (e.g. - /// LabVmsShutdownTask, LabVmAutoStart). - /// - [JsonProperty(PropertyName = "properties.taskType")] - public string TaskType { get; set; } - - /// - /// Gets or sets if the schedule will occur only some days of the week, - /// specify the weekly recurrence. - /// - [JsonProperty(PropertyName = "properties.weeklyRecurrence")] - public WeekDetailsFragment WeeklyRecurrence { get; set; } - - /// - /// Gets or sets if the schedule will occur once each day of the week, - /// specify the daily recurrence. - /// - [JsonProperty(PropertyName = "properties.dailyRecurrence")] - public DayDetailsFragment DailyRecurrence { get; set; } - - /// - /// Gets or sets if the schedule will occur multiple times a day, - /// specify the hourly recurrence. - /// - [JsonProperty(PropertyName = "properties.hourlyRecurrence")] - public HourDetailsFragment HourlyRecurrence { get; set; } - - /// - /// Gets or sets the time zone ID (e.g. Pacific Standard time). - /// - [JsonProperty(PropertyName = "properties.timeZoneId")] - public string TimeZoneId { get; set; } - - /// - /// Gets or sets notification settings. - /// - [JsonProperty(PropertyName = "properties.notificationSettings")] - public NotificationSettingsFragment NotificationSettings { get; set; } - - /// - /// Gets or sets the resource ID to which the schedule belongs - /// - [JsonProperty(PropertyName = "properties.targetResourceId")] - public string TargetResourceId { get; set; } - - /// - /// Gets or sets the name of the virtual machine or environment - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the location of the new virtual machine or environment - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the tags of the resource. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs index 4828a9706c46..44431e77725f 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// A schedule. /// [Rest.Serialization.JsonTransformation] - public partial class ScheduleFragment : UpdateResource + public partial class ScheduleFragment : Resource { /// /// Initializes a new instance of the ScheduleFragment class. @@ -34,6 +34,10 @@ public ScheduleFragment() /// /// Initializes a new instance of the ScheduleFragment class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// The status of the schedule (i.e. Enabled, /// Disabled). Possible values include: 'Enabled', 'Disabled' @@ -50,8 +54,12 @@ public ScheduleFragment() /// Notification settings. /// The resource ID to which the /// schedule belongs - public ScheduleFragment(IDictionary tags = default(IDictionary), string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string)) - : base(tags) + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public ScheduleFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) { Status = status; TaskType = taskType; @@ -61,6 +69,8 @@ public ScheduleFragment() TimeZoneId = timeZoneId; NotificationSettings = notificationSettings; TargetResourceId = targetResourceId; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -122,5 +132,17 @@ public ScheduleFragment() [JsonProperty(PropertyName = "properties.targetResourceId")] public string TargetResourceId { get; set; } + /// + /// Gets or sets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } + } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs index 8bd71cbbba36..026abc4f91dd 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs @@ -66,16 +66,16 @@ public Secret() public string Value { get; set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretFragment.cs deleted file mode 100644 index 05a5861fdcca..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretFragment.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A secret. - /// - [Rest.Serialization.JsonTransformation] - public partial class SecretFragment : UpdateResource - { - /// - /// Initializes a new instance of the SecretFragment class. - /// - public SecretFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecretFragment class. - /// - /// The tags of the resource. - /// The value of the secret for secret - /// creation. - public SecretFragment(IDictionary tags = default(IDictionary), string value = default(string)) - : base(tags) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the value of the secret for secret creation. - /// - [JsonProperty(PropertyName = "properties.value")] - public string Value { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabric.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabric.cs deleted file mode 100644 index dcde63d1e395..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabric.cs +++ /dev/null @@ -1,100 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A Service Fabric. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServiceFabric : Resource - { - /// - /// Initializes a new instance of the ServiceFabric class. - /// - public ServiceFabric() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServiceFabric class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The backing service fabric - /// resource's id - /// The resource id of the environment - /// under which the service fabric resource is present - /// The applicable schedule for the - /// virtual machine. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public ServiceFabric(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string externalServiceFabricId = default(string), string environmentId = default(string), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) - { - ExternalServiceFabricId = externalServiceFabricId; - EnvironmentId = environmentId; - ApplicableSchedule = applicableSchedule; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the backing service fabric resource's id - /// - [JsonProperty(PropertyName = "properties.externalServiceFabricId")] - public string ExternalServiceFabricId { get; set; } - - /// - /// Gets or sets the resource id of the environment under which the - /// service fabric resource is present - /// - [JsonProperty(PropertyName = "properties.environmentId")] - public string EnvironmentId { get; set; } - - /// - /// Gets the applicable schedule for the virtual machine. - /// - [JsonProperty(PropertyName = "properties.applicableSchedule")] - public ApplicableSchedule ApplicableSchedule { get; private set; } - - /// - /// Gets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabricFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabricFragment.cs deleted file mode 100644 index a652b7e4785a..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceFabricFragment.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A Service Fabric. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServiceFabricFragment : UpdateResource - { - /// - /// Initializes a new instance of the ServiceFabricFragment class. - /// - public ServiceFabricFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServiceFabricFragment class. - /// - /// The tags of the resource. - /// The backing service fabric - /// resource's id - /// The resource id of the environment - /// under which the service fabric resource is present - public ServiceFabricFragment(IDictionary tags = default(IDictionary), string externalServiceFabricId = default(string), string environmentId = default(string)) - : base(tags) - { - ExternalServiceFabricId = externalServiceFabricId; - EnvironmentId = environmentId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the backing service fabric resource's id - /// - [JsonProperty(PropertyName = "properties.externalServiceFabricId")] - public string ExternalServiceFabricId { get; set; } - - /// - /// Gets or sets the resource id of the environment under which the - /// service fabric resource is present - /// - [JsonProperty(PropertyName = "properties.environmentId")] - public string EnvironmentId { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs index 4e70356a1587..7821c7413bc5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs @@ -42,9 +42,6 @@ public ShutdownNotificationContent() /// The GUID for the virtual machine to be shut /// down. /// The owner of the virtual machine. - /// The URL of the virtual machine. - /// Minutes remaining until - /// shutdown /// The event for which a notification will be /// sent. /// The text for the notification. @@ -53,7 +50,7 @@ public ShutdownNotificationContent() /// The resource group name for the /// schedule. /// The lab for the schedule. - public ShutdownNotificationContent(string skipUrl = default(string), string delayUrl60 = default(string), string delayUrl120 = default(string), string vmName = default(string), string guid = default(string), string owner = default(string), string vmUrl = default(string), string minutesUntilShutdown = default(string), string eventType = default(string), string text = default(string), string subscriptionId = default(string), string resourceGroupName = default(string), string labName = default(string)) + public ShutdownNotificationContent(string skipUrl = default(string), string delayUrl60 = default(string), string delayUrl120 = default(string), string vmName = default(string), string guid = default(string), string owner = default(string), string eventType = default(string), string text = default(string), string subscriptionId = default(string), string resourceGroupName = default(string), string labName = default(string)) { SkipUrl = skipUrl; DelayUrl60 = delayUrl60; @@ -61,8 +58,6 @@ public ShutdownNotificationContent() VmName = vmName; Guid = guid; Owner = owner; - VmUrl = vmUrl; - MinutesUntilShutdown = minutesUntilShutdown; EventType = eventType; Text = text; SubscriptionId = subscriptionId; @@ -112,18 +107,6 @@ public ShutdownNotificationContent() [JsonProperty(PropertyName = "owner")] public string Owner { get; set; } - /// - /// Gets or sets the URL of the virtual machine. - /// - [JsonProperty(PropertyName = "vmUrl")] - public string VmUrl { get; set; } - - /// - /// Gets or sets minutes remaining until shutdown - /// - [JsonProperty(PropertyName = "minutesUntilShutdown")] - public string MinutesUntilShutdown { get; set; } - /// /// Gets or sets the event for which a notification will be sent. /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UpdateResource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UpdateResource.cs deleted file mode 100644 index b37614587664..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UpdateResource.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents an update resource - /// - public partial class UpdateResource - { - /// - /// Initializes a new instance of the UpdateResource class. - /// - public UpdateResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateResource class. - /// - /// The tags of the resource. - 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 the tags of the resource. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs index 8d3523eaa857..7cd5069725ea 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs @@ -82,16 +82,16 @@ public User() public System.DateTime? CreatedDate { get; private set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs index 9882a2c4c9c4..a761054ed318 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// Profile of a lab user. /// [Rest.Serialization.JsonTransformation] - public partial class UserFragment : UpdateResource + public partial class UserFragment : Resource { /// /// Initializes a new instance of the UserFragment class. @@ -34,14 +34,24 @@ public UserFragment() /// /// Initializes a new instance of the UserFragment class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// The identity of the user. /// The secret store of the user. - public UserFragment(IDictionary tags = default(IDictionary), UserIdentityFragment identity = default(UserIdentityFragment), UserSecretStoreFragment secretStore = default(UserSecretStoreFragment)) - : base(tags) + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public UserFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), UserIdentityFragment identity = default(UserIdentityFragment), UserSecretStoreFragment secretStore = default(UserSecretStoreFragment), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) { Identity = identity; SecretStore = secretStore; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -62,5 +72,17 @@ public UserFragment() [JsonProperty(PropertyName = "properties.secretStore")] public UserSecretStoreFragment SecretStore { get; set; } + /// + /// Gets or sets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } + } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs index 59fe1a1ae8e7..3a27d184f4fc 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs @@ -94,10 +94,10 @@ public VirtualNetwork() public string ExternalProviderResourceId { get; set; } /// - /// Gets the external subnet properties. + /// Gets or sets the external subnet properties. /// [JsonProperty(PropertyName = "properties.externalSubnets")] - public IList ExternalSubnets { get; private set; } + public IList ExternalSubnets { get; set; } /// /// Gets or sets the subnet overrides of the virtual network. @@ -112,16 +112,16 @@ public VirtualNetwork() public System.DateTime? CreatedDate { get; private set; } /// - /// Gets the provisioning status of the resource. + /// Gets or sets the provisioning status of the resource. /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// - /// Gets the unique immutable identifier of a resource (Guid). + /// Gets or sets the unique immutable identifier of a resource (Guid). /// [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; private set; } + public string UniqueIdentifier { get; set; } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs index 57dfabe0840f..7e795d721327 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// A virtual network. /// [Rest.Serialization.JsonTransformation] - public partial class VirtualNetworkFragment : UpdateResource + public partial class VirtualNetworkFragment : Resource { /// /// Initializes a new instance of the VirtualNetworkFragment class. @@ -34,6 +34,10 @@ public VirtualNetworkFragment() /// /// Initializes a new instance of the VirtualNetworkFragment class. /// + /// The identifier of the resource. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. /// The tags of the resource. /// The allowed subnets of the virtual /// network. @@ -41,15 +45,24 @@ public VirtualNetworkFragment() /// network. /// The Microsoft.Network /// resource identifier of the virtual network. + /// The external subnet + /// properties. /// The subnet overrides of the virtual /// network. - public VirtualNetworkFragment(IDictionary tags = default(IDictionary), IList allowedSubnets = default(IList), string description = default(string), string externalProviderResourceId = default(string), IList subnetOverrides = default(IList)) - : base(tags) + /// The provisioning status of the + /// resource. + /// The unique immutable identifier of a + /// resource (Guid). + public VirtualNetworkFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList allowedSubnets = default(IList), string description = default(string), string externalProviderResourceId = default(string), IList externalSubnets = default(IList), IList subnetOverrides = default(IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + : base(id, name, type, location, tags) { AllowedSubnets = allowedSubnets; Description = description; ExternalProviderResourceId = externalProviderResourceId; + ExternalSubnets = externalSubnets; SubnetOverrides = subnetOverrides; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -77,11 +90,29 @@ public VirtualNetworkFragment() [JsonProperty(PropertyName = "properties.externalProviderResourceId")] public string ExternalProviderResourceId { get; set; } + /// + /// Gets or sets the external subnet properties. + /// + [JsonProperty(PropertyName = "properties.externalSubnets")] + public IList ExternalSubnets { get; set; } + /// /// Gets or sets the subnet overrides of the virtual network. /// [JsonProperty(PropertyName = "properties.subnetOverrides")] public IList SubnetOverrides { get; set; } + /// + /// Gets or sets the provisioning status of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier { get; set; } + } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfoFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfoFragment.cs deleted file mode 100644 index 90e4e3199297..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfoFragment.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Information about a Windows OS. - /// - public partial class WindowsOsInfoFragment - { - /// - /// Initializes a new instance of the WindowsOsInfoFragment class. - /// - public WindowsOsInfoFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the WindowsOsInfoFragment class. - /// - /// The state of the Windows OS (i.e. - /// NonSysprepped, SysprepRequested, SysprepApplied). Possible values - /// include: 'NonSysprepped', 'SysprepRequested', - /// 'SysprepApplied' - public WindowsOsInfoFragment(string windowsOsState = default(string)) - { - WindowsOsState = windowsOsState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the state of the Windows OS (i.e. NonSysprepped, - /// SysprepRequested, SysprepApplied). Possible values include: - /// 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' - /// - [JsonProperty(PropertyName = "windowsOsState")] - public string WindowsOsState { get; set; } - - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs index 6ae26e6c6117..1b5b7fbd7a03 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs @@ -54,9 +54,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// List notificationchannels in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal NotificationChannelsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// Get notificationchannel. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -295,15 +288,15 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -324,7 +317,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -335,7 +327,7 @@ internal NotificationChannelsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -475,9 +467,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// Create or replace an existing notificationChannel. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -508,15 +497,15 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, NotificationChannel notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, NotificationChannel notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -541,7 +530,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("notificationChannel", notificationChannel); @@ -552,7 +540,7 @@ internal NotificationChannelsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -712,9 +700,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// Delete notificationchannel. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -739,15 +724,15 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -768,7 +753,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -778,7 +762,7 @@ internal NotificationChannelsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -896,9 +880,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// Modify properties of notificationchannels. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -929,15 +910,15 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, NotificationChannelFragment notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string labName, string name, NotificationChannelFragment notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -962,7 +943,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("notificationChannel", notificationChannel); @@ -973,7 +953,7 @@ internal NotificationChannelsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -1115,9 +1095,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// Send notification to provided channel. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1145,15 +1122,15 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task NotifyWithHttpMessagesAsync(string resourceGroupName, string labName, string name, NotifyParameters notifyParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task NotifyWithHttpMessagesAsync(string labName, string name, NotifyParameters notifyParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1178,7 +1155,6 @@ internal NotificationChannelsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("notifyParameters", notifyParameters); @@ -1189,7 +1165,7 @@ internal NotificationChannelsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs index 064d2cd4251e..a88399c64d25 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class NotificationChannelsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this INotificationChannelsOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this INotificationChannelsOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class NotificationChannelsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class NotificationChannelsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this INotificationChannelsOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,9 +68,6 @@ public static partial class NotificationChannelsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,9 +77,9 @@ public static partial class NotificationChannelsOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=webHookUrl)' /// - public static NotificationChannel Get(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static NotificationChannel Get(this INotificationChannelsOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -97,9 +88,6 @@ public static partial class NotificationChannelsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -112,9 +100,9 @@ public static partial class NotificationChannelsOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this INotificationChannelsOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -126,9 +114,6 @@ public static partial class NotificationChannelsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -138,9 +123,9 @@ public static partial class NotificationChannelsOperationsExtensions /// /// A notification. /// - public static NotificationChannel CreateOrUpdate(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotificationChannel notificationChannel) + public static NotificationChannel CreateOrUpdate(this INotificationChannelsOperations operations, string labName, string name, NotificationChannel notificationChannel) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, notificationChannel).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, notificationChannel).GetAwaiter().GetResult(); } /// @@ -149,9 +134,6 @@ public static NotificationChannel CreateOrUpdate(this INotificationChannelsOpera /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -164,9 +146,9 @@ public static NotificationChannel CreateOrUpdate(this INotificationChannelsOpera /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotificationChannel notificationChannel, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this INotificationChannelsOperations operations, string labName, string name, NotificationChannel notificationChannel, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -178,18 +160,15 @@ public static NotificationChannel CreateOrUpdate(this INotificationChannelsOpera /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the notificationChannel. /// - public static void Delete(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this INotificationChannelsOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -198,9 +177,6 @@ public static void Delete(this INotificationChannelsOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -210,9 +186,9 @@ public static void Delete(this INotificationChannelsOperations operations, strin /// /// The cancellation token. /// - public static async Task DeleteAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this INotificationChannelsOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -221,9 +197,6 @@ public static void Delete(this INotificationChannelsOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -233,9 +206,9 @@ public static void Delete(this INotificationChannelsOperations operations, strin /// /// A notification. /// - public static NotificationChannel Update(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotificationChannelFragment notificationChannel) + public static NotificationChannel Update(this INotificationChannelsOperations operations, string labName, string name, NotificationChannelFragment notificationChannel) { - return operations.UpdateAsync(resourceGroupName, labName, name, notificationChannel).GetAwaiter().GetResult(); + return operations.UpdateAsync(labName, name, notificationChannel).GetAwaiter().GetResult(); } /// @@ -244,9 +217,6 @@ public static NotificationChannel Update(this INotificationChannelsOperations op /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -259,9 +229,9 @@ public static NotificationChannel Update(this INotificationChannelsOperations op /// /// The cancellation token. /// - public static async Task UpdateAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotificationChannelFragment notificationChannel, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this INotificationChannelsOperations operations, string labName, string name, NotificationChannelFragment notificationChannel, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -273,9 +243,6 @@ public static NotificationChannel Update(this INotificationChannelsOperations op /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -285,9 +252,9 @@ public static NotificationChannel Update(this INotificationChannelsOperations op /// /// Properties for generating a Notification. /// - public static void Notify(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotifyParameters notifyParameters) + public static void Notify(this INotificationChannelsOperations operations, string labName, string name, NotifyParameters notifyParameters) { - operations.NotifyAsync(resourceGroupName, labName, name, notifyParameters).GetAwaiter().GetResult(); + operations.NotifyAsync(labName, name, notifyParameters).GetAwaiter().GetResult(); } /// @@ -296,9 +263,6 @@ public static void Notify(this INotificationChannelsOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -311,9 +275,9 @@ public static void Notify(this INotificationChannelsOperations operations, strin /// /// The cancellation token. /// - public static async Task NotifyAsync(this INotificationChannelsOperations operations, string resourceGroupName, string labName, string name, NotifyParameters notifyParameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task NotifyAsync(this INotificationChannelsOperations operations, string labName, string name, NotifyParameters notifyParameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.NotifyWithHttpMessagesAsync(resourceGroupName, labName, name, notifyParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.NotifyWithHttpMessagesAsync(labName, name, notifyParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs index 74fafef9a6ed..60a05ffeb240 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs @@ -54,9 +54,6 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// List policies in a given policy set. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -87,15 +84,15 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -117,7 +114,6 @@ internal PoliciesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,7 +123,7 @@ internal PoliciesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); List _queryParameters = new List(); @@ -271,9 +267,6 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// Get policy. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -307,15 +300,15 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string policySetName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -340,7 +333,6 @@ internal PoliciesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("name", name); @@ -352,7 +344,7 @@ internal PoliciesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -493,9 +485,6 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// Create or replace an existing policy. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -529,15 +518,15 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, string name, Policy policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string policySetName, string name, Policy policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -566,7 +555,6 @@ internal PoliciesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("name", name); @@ -578,7 +566,7 @@ internal PoliciesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -739,9 +727,6 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// Delete policy. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -769,15 +754,15 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string policySetName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -802,7 +787,6 @@ internal PoliciesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("name", name); @@ -813,7 +797,7 @@ internal PoliciesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -932,9 +916,6 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// Modify properties of policies. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -968,15 +949,15 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string policySetName, string name, PolicyFragment policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string labName, string policySetName, string name, PolicyFragment policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1005,7 +986,6 @@ internal PoliciesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("name", name); @@ -1017,7 +997,7 @@ internal PoliciesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs index 6723927d73ae..63c1bde0da21 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs @@ -28,9 +28,6 @@ public static partial class PoliciesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -40,9 +37,9 @@ public static partial class PoliciesOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage List(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IPoliciesOperations operations, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, policySetName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, policySetName, odataQuery).GetAwaiter().GetResult(); } /// @@ -51,9 +48,6 @@ public static partial class PoliciesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -66,9 +60,9 @@ public static partial class PoliciesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IPoliciesOperations operations, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, policySetName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, policySetName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -80,9 +74,6 @@ public static partial class PoliciesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -95,9 +86,9 @@ public static partial class PoliciesOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=description)' /// - public static Policy Get(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, string expand = default(string)) + public static Policy Get(this IPoliciesOperations operations, string labName, string policySetName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, policySetName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, policySetName, name, expand).GetAwaiter().GetResult(); } /// @@ -106,9 +97,6 @@ public static partial class PoliciesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -124,9 +112,9 @@ public static partial class PoliciesOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, policySetName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, policySetName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -138,9 +126,6 @@ public static partial class PoliciesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -153,9 +138,9 @@ public static partial class PoliciesOperationsExtensions /// /// A Policy. /// - public static Policy CreateOrUpdate(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, Policy policy) + public static Policy CreateOrUpdate(this IPoliciesOperations operations, string labName, string policySetName, string name, Policy policy) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, policySetName, name, policy).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, policySetName, name, policy).GetAwaiter().GetResult(); } /// @@ -164,9 +149,6 @@ public static Policy CreateOrUpdate(this IPoliciesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -182,9 +164,9 @@ public static Policy CreateOrUpdate(this IPoliciesOperations operations, string /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, Policy policy, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, Policy policy, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -196,9 +178,6 @@ public static Policy CreateOrUpdate(this IPoliciesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -208,9 +187,9 @@ public static Policy CreateOrUpdate(this IPoliciesOperations operations, string /// /// The name of the policy. /// - public static void Delete(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name) + public static void Delete(this IPoliciesOperations operations, string labName, string policySetName, string name) { - operations.DeleteAsync(resourceGroupName, labName, policySetName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, policySetName, name).GetAwaiter().GetResult(); } /// @@ -219,9 +198,6 @@ public static void Delete(this IPoliciesOperations operations, string resourceGr /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -234,9 +210,9 @@ public static void Delete(this IPoliciesOperations operations, string resourceGr /// /// The cancellation token. /// - public static async Task DeleteAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, policySetName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, policySetName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -245,9 +221,6 @@ public static void Delete(this IPoliciesOperations operations, string resourceGr /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -260,9 +233,9 @@ public static void Delete(this IPoliciesOperations operations, string resourceGr /// /// A Policy. /// - public static Policy Update(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, PolicyFragment policy) + public static Policy Update(this IPoliciesOperations operations, string labName, string policySetName, string name, PolicyFragment policy) { - return operations.UpdateAsync(resourceGroupName, labName, policySetName, name, policy).GetAwaiter().GetResult(); + return operations.UpdateAsync(labName, policySetName, name, policy).GetAwaiter().GetResult(); } /// @@ -271,9 +244,6 @@ public static Policy Update(this IPoliciesOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -289,9 +259,9 @@ public static Policy Update(this IPoliciesOperations operations, string resource /// /// The cancellation token. /// - public static async Task UpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string labName, string policySetName, string name, PolicyFragment policy, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, PolicyFragment policy, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs index 49dfadb1381d..f6f87d9f07c6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs @@ -53,9 +53,6 @@ internal PolicySetsOperations(DevTestLabsClient client) /// /// Evaluates lab policy. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,15 +83,15 @@ internal PolicySetsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> EvaluatePoliciesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> EvaluatePoliciesWithHttpMessagesAsync(string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -119,7 +116,6 @@ internal PolicySetsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("evaluatePoliciesRequest", evaluatePoliciesRequest); @@ -130,7 +126,7 @@ internal PolicySetsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs index 1139c6158a57..28e99c588e53 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs @@ -27,9 +27,6 @@ public static partial class PolicySetsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -39,9 +36,9 @@ public static partial class PolicySetsOperationsExtensions /// /// Request body for evaluating a policy set. /// - public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetsOperations operations, string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest) + public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetsOperations operations, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest) { - return operations.EvaluatePoliciesAsync(resourceGroupName, labName, name, evaluatePoliciesRequest).GetAwaiter().GetResult(); + return operations.EvaluatePoliciesAsync(labName, name, evaluatePoliciesRequest).GetAwaiter().GetResult(); } /// @@ -50,9 +47,6 @@ public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetsOperatio /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -65,9 +59,9 @@ public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetsOperatio /// /// The cancellation token. /// - public static async Task EvaluatePoliciesAsync(this IPolicySetsOperations operations, string resourceGroupName, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task EvaluatePoliciesAsync(this IPolicySetsOperations operations, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.EvaluatePoliciesWithHttpMessagesAsync(resourceGroupName, labName, name, evaluatePoliciesRequest, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.EvaluatePoliciesWithHttpMessagesAsync(labName, name, evaluatePoliciesRequest, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs index 255af83eae5a..68eb07a7fb9c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs @@ -54,9 +54,6 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// List schedules in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal SchedulesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal SchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// Get schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -295,15 +288,15 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -324,7 +317,6 @@ internal SchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -335,7 +327,7 @@ internal SchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -475,9 +467,6 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// Create or replace an existing schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -508,15 +497,15 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -541,7 +530,6 @@ internal SchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("schedule", schedule); @@ -552,7 +540,7 @@ internal SchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -712,9 +700,6 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// Delete schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -739,15 +724,15 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -768,7 +753,6 @@ internal SchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -778,7 +762,7 @@ internal SchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -896,9 +880,6 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// Modify properties of schedules. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -929,15 +910,15 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string labName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -962,7 +943,6 @@ internal SchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("schedule", schedule); @@ -973,7 +953,7 @@ internal SchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -1115,9 +1095,6 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1130,19 +1107,16 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Lists all applicable schedules /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1170,15 +1144,15 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListApplicableWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListApplicableWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1199,7 +1173,6 @@ internal SchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1209,7 +1182,7 @@ internal SchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -1345,9 +1318,6 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1372,15 +1342,15 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginExecuteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1401,7 +1371,6 @@ internal SchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1411,7 +1380,7 @@ internal SchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs index 6e9842798bf7..88ceac2ea83c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class SchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this ISchedulesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this ISchedulesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class SchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class SchedulesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this ISchedulesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,9 +68,6 @@ public static partial class SchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,9 +77,9 @@ public static partial class SchedulesOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=status)' /// - public static Schedule Get(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static Schedule Get(this ISchedulesOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -97,9 +88,6 @@ public static partial class SchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -112,9 +100,9 @@ public static partial class SchedulesOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ISchedulesOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -126,9 +114,6 @@ public static partial class SchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -138,9 +123,9 @@ public static partial class SchedulesOperationsExtensions /// /// A schedule. /// - public static Schedule CreateOrUpdate(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, Schedule schedule) + public static Schedule CreateOrUpdate(this ISchedulesOperations operations, string labName, string name, Schedule schedule) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, schedule).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, schedule).GetAwaiter().GetResult(); } /// @@ -149,9 +134,6 @@ public static Schedule CreateOrUpdate(this ISchedulesOperations operations, stri /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -164,9 +146,9 @@ public static Schedule CreateOrUpdate(this ISchedulesOperations operations, stri /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ISchedulesOperations operations, string labName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -178,18 +160,15 @@ public static Schedule CreateOrUpdate(this ISchedulesOperations operations, stri /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the schedule. /// - public static void Delete(this ISchedulesOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this ISchedulesOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -198,9 +177,6 @@ public static void Delete(this ISchedulesOperations operations, string resourceG /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -210,9 +186,9 @@ public static void Delete(this ISchedulesOperations operations, string resourceG /// /// The cancellation token. /// - public static async Task DeleteAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this ISchedulesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -221,9 +197,6 @@ public static void Delete(this ISchedulesOperations operations, string resourceG /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -233,9 +206,9 @@ public static void Delete(this ISchedulesOperations operations, string resourceG /// /// A schedule. /// - public static Schedule Update(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, ScheduleFragment schedule) + public static Schedule Update(this ISchedulesOperations operations, string labName, string name, ScheduleFragment schedule) { - return operations.UpdateAsync(resourceGroupName, labName, name, schedule).GetAwaiter().GetResult(); + return operations.UpdateAsync(labName, name, schedule).GetAwaiter().GetResult(); } /// @@ -244,9 +217,6 @@ public static Schedule Update(this ISchedulesOperations operations, string resou /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -259,9 +229,9 @@ public static Schedule Update(this ISchedulesOperations operations, string resou /// /// The cancellation token. /// - public static async Task UpdateAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ISchedulesOperations operations, string labName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -273,18 +243,15 @@ public static Schedule Update(this ISchedulesOperations operations, string resou /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the schedule. /// - public static void Execute(this ISchedulesOperations operations, string resourceGroupName, string labName, string name) + public static void Execute(this ISchedulesOperations operations, string labName, string name) { - operations.ExecuteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.ExecuteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -293,9 +260,6 @@ public static void Execute(this ISchedulesOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -305,9 +269,9 @@ public static void Execute(this ISchedulesOperations operations, string resource /// /// The cancellation token. /// - public static async Task ExecuteAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExecuteAsync(this ISchedulesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ExecuteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -316,18 +280,15 @@ public static void Execute(this ISchedulesOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the schedule. /// - public static IPage ListApplicable(this ISchedulesOperations operations, string resourceGroupName, string labName, string name) + public static IPage ListApplicable(this ISchedulesOperations operations, string labName, string name) { - return operations.ListApplicableAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + return operations.ListApplicableAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -336,9 +297,6 @@ public static IPage ListApplicable(this ISchedulesOperations operation /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -348,9 +306,9 @@ public static IPage ListApplicable(this ISchedulesOperations operation /// /// The cancellation token. /// - public static async Task> ListApplicableAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListApplicableAsync(this ISchedulesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListApplicableWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListApplicableWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -362,18 +320,15 @@ public static IPage ListApplicable(this ISchedulesOperations operation /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the schedule. /// - public static void BeginExecute(this ISchedulesOperations operations, string resourceGroupName, string labName, string name) + public static void BeginExecute(this ISchedulesOperations operations, string labName, string name) { - operations.BeginExecuteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.BeginExecuteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -382,9 +337,6 @@ public static void BeginExecute(this ISchedulesOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -394,9 +346,9 @@ public static void BeginExecute(this ISchedulesOperations operations, string res /// /// The cancellation token. /// - public static async Task BeginExecuteAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginExecuteAsync(this ISchedulesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginExecuteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs index 2aafa74d6b54..5055a941c9c3 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs @@ -19,31 +19,29 @@ public static IEnumerable> ApiInfo_DevTestLabsClie { return new Tuple[] { - new Tuple("DevTestLab", "ArmTemplates", "2018-09-15"), - new Tuple("DevTestLab", "ArtifactSources", "2018-09-15"), - new Tuple("DevTestLab", "Artifacts", "2018-09-15"), - new Tuple("DevTestLab", "Costs", "2018-09-15"), - new Tuple("DevTestLab", "CustomImages", "2018-09-15"), - new Tuple("DevTestLab", "Disks", "2018-09-15"), - new Tuple("DevTestLab", "Environments", "2018-09-15"), - new Tuple("DevTestLab", "Formulas", "2018-09-15"), - new Tuple("DevTestLab", "GalleryImages", "2018-09-15"), - new Tuple("DevTestLab", "GlobalSchedules", "2018-09-15"), - new Tuple("DevTestLab", "Labs", "2018-09-15"), - new Tuple("DevTestLab", "NotificationChannels", "2018-09-15"), - new Tuple("DevTestLab", "Operations", "2018-09-15"), - new Tuple("DevTestLab", "Policies", "2018-09-15"), - new Tuple("DevTestLab", "PolicySets", "2018-09-15"), - new Tuple("DevTestLab", "ProviderOperations", "2018-09-15"), - new Tuple("DevTestLab", "Schedules", "2018-09-15"), - new Tuple("DevTestLab", "Secrets", "2018-09-15"), - new Tuple("DevTestLab", "ServiceFabricSchedules", "2018-09-15"), - new Tuple("DevTestLab", "ServiceFabrics", "2018-09-15"), - new Tuple("DevTestLab", "ServiceRunners", "2018-09-15"), - new Tuple("DevTestLab", "Users", "2018-09-15"), - new Tuple("DevTestLab", "VirtualMachineSchedules", "2018-09-15"), - new Tuple("DevTestLab", "VirtualMachines", "2018-09-15"), - new Tuple("DevTestLab", "VirtualNetworks", "2018-09-15"), + new Tuple("DevTestLab", "ArmTemplates", "2016-05-15"), + new Tuple("DevTestLab", "ArtifactSources", "2016-05-15"), + new Tuple("DevTestLab", "Artifacts", "2016-05-15"), + new Tuple("DevTestLab", "Costs", "2016-05-15"), + new Tuple("DevTestLab", "CustomImages", "2016-05-15"), + new Tuple("DevTestLab", "Disks", "2016-05-15"), + new Tuple("DevTestLab", "Environments", "2016-05-15"), + new Tuple("DevTestLab", "Formulas", "2016-05-15"), + new Tuple("DevTestLab", "GalleryImages", "2016-05-15"), + new Tuple("DevTestLab", "GlobalSchedules", "2016-05-15"), + new Tuple("DevTestLab", "Labs", "2016-05-15"), + new Tuple("DevTestLab", "NotificationChannels", "2016-05-15"), + new Tuple("DevTestLab", "Operations", "2016-05-15"), + new Tuple("DevTestLab", "Policies", "2016-05-15"), + new Tuple("DevTestLab", "PolicySets", "2016-05-15"), + new Tuple("DevTestLab", "ProviderOperations", "2016-05-15"), + new Tuple("DevTestLab", "Schedules", "2016-05-15"), + new Tuple("DevTestLab", "Secrets", "2016-05-15"), + new Tuple("DevTestLab", "ServiceRunners", "2016-05-15"), + new Tuple("DevTestLab", "Users", "2016-05-15"), + new Tuple("DevTestLab", "VirtualMachineSchedules", "2016-05-15"), + new Tuple("DevTestLab", "VirtualMachines", "2016-05-15"), + new Tuple("DevTestLab", "VirtualNetworks", "2016-05-15"), }.AsEnumerable(); } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs index 320ddbd030af..aeb99cd36e7c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs @@ -54,9 +54,6 @@ internal SecretsOperations(DevTestLabsClient client) /// /// List secrets in a given user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -87,15 +84,15 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -117,7 +114,6 @@ internal SecretsOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,7 +123,7 @@ internal SecretsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); List _queryParameters = new List(); @@ -271,9 +267,6 @@ internal SecretsOperations(DevTestLabsClient client) /// /// Get secret. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -307,15 +300,15 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string userName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -340,7 +333,6 @@ internal SecretsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); @@ -352,7 +344,7 @@ internal SecretsOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -491,236 +483,8 @@ internal SecretsOperations(DevTestLabsClient client) } /// - /// Create or replace an existing secret. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// A secret. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, secret, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Delete secret. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// 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 labName, string userName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - 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.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// Modify properties of secrets. + /// Create or replace an existing secret. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -754,15 +518,15 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, SecretFragment secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -791,19 +555,18 @@ internal SecretsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); tracingParameters.Add("secret", secret); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + 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.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -819,7 +582,7 @@ internal SecretsOperations(DevTestLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -876,7 +639,7 @@ internal SecretsOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -936,6 +699,24 @@ internal SecretsOperations(DevTestLabsClient client) 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); @@ -944,12 +725,8 @@ internal SecretsOperations(DevTestLabsClient client) } /// - /// Create or replace an existing secret. This operation can take a while to - /// complete. + /// Delete secret. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -959,9 +736,6 @@ internal SecretsOperations(DevTestLabsClient client) /// /// The name of the secret. /// - /// - /// A secret. - /// /// /// Headers that will be added to request. /// @@ -971,9 +745,6 @@ internal SecretsOperations(DevTestLabsClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -983,15 +754,15 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1005,10 +776,6 @@ internal SecretsOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (secret == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "secret"); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1020,19 +787,17 @@ internal SecretsOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); - tracingParameters.Add("secret", secret); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + 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.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -1048,7 +813,7 @@ internal SecretsOperations(DevTestLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1079,12 +844,6 @@ internal SecretsOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; - if(secret != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(secret, 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) { @@ -1105,7 +864,7 @@ internal SecretsOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1140,49 +899,13 @@ internal SecretsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.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); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs index ec8527f3eabe..1f4208e9e918 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs @@ -28,9 +28,6 @@ public static partial class SecretsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -40,9 +37,9 @@ public static partial class SecretsOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage List(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this ISecretsOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, userName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); } /// @@ -51,9 +48,6 @@ public static partial class SecretsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -66,9 +60,9 @@ public static partial class SecretsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this ISecretsOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -80,9 +74,6 @@ public static partial class SecretsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -95,9 +86,9 @@ public static partial class SecretsOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=value)' /// - public static Secret Get(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string)) + public static Secret Get(this ISecretsOperations operations, string labName, string userName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, userName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); } /// @@ -106,9 +97,6 @@ public static partial class SecretsOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -124,24 +112,20 @@ public static partial class SecretsOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ISecretsOperations operations, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Create or replace an existing secret. This operation can take a while to - /// complete. + /// Create or replace an existing secret. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -154,21 +138,17 @@ public static partial class SecretsOperationsExtensions /// /// A secret. /// - public static Secret CreateOrUpdate(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, Secret secret) + public static Secret CreateOrUpdate(this ISecretsOperations operations, string labName, string userName, string name, Secret secret) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, name, secret).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, userName, name, secret).GetAwaiter().GetResult(); } /// - /// Create or replace an existing secret. This operation can take a while to - /// complete. + /// Create or replace an existing secret. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -184,9 +164,9 @@ public static Secret CreateOrUpdate(this ISecretsOperations operations, string r /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, Secret secret, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ISecretsOperations operations, string labName, string userName, string name, Secret secret, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -198,9 +178,6 @@ public static Secret CreateOrUpdate(this ISecretsOperations operations, string r /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -210,9 +187,9 @@ public static Secret CreateOrUpdate(this ISecretsOperations operations, string r /// /// The name of the secret. /// - public static void Delete(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name) + public static void Delete(this ISecretsOperations operations, string labName, string userName, string name) { - operations.DeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); } /// @@ -221,121 +198,6 @@ public static void Delete(this ISecretsOperations operations, string resourceGro /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// A secret. - /// - public static Secret Update(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, SecretFragment secret) - { - return operations.UpdateAsync(resourceGroupName, labName, userName, name, secret).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// A secret. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, SecretFragment secret, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing secret. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// A secret. - /// - public static Secret BeginCreateOrUpdate(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, Secret secret) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, userName, name, secret).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing secret. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -345,18 +207,12 @@ public static Secret BeginCreateOrUpdate(this ISecretsOperations operations, str /// /// The name of the secret. /// - /// - /// A secret. - /// /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this ISecretsOperations operations, string resourceGroupName, string labName, string userName, string name, Secret secret, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this ISecretsOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperations.cs deleted file mode 100644 index 8521bda504ea..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperations.cs +++ /dev/null @@ -1,1612 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs -{ - 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; - - /// - /// ServiceFabricSchedulesOperations operations. - /// - internal partial class ServiceFabricSchedulesOperations : IServiceOperations, IServiceFabricSchedulesOperations - { - /// - /// Initializes a new instance of the ServiceFabricSchedulesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ServiceFabricSchedulesOperations(DevTestLabsClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the DevTestLabsClient - /// - public DevTestLabsClient Client { get; private set; } - - /// - /// List schedules in a given service fabric. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (serviceFabricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // 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("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("serviceFabricName", serviceFabricName); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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 schedule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string userName, string serviceFabricName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (serviceFabricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("serviceFabricName", serviceFabricName); - tracingParameters.Add("name", name); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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 replace an existing schedule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string userName, string serviceFabricName, string name, Schedule schedule, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (serviceFabricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (schedule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("serviceFabricName", serviceFabricName); - tracingParameters.Add("name", name); - tracingParameters.Add("schedule", schedule); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(schedule != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); - } - System.Net.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; - } - - /// - /// Delete schedule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// 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 labName, string userName, string serviceFabricName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (serviceFabricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("serviceFabricName", serviceFabricName); - tracingParameters.Add("name", name); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// Modify properties of schedules. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string userName, string serviceFabricName, string name, ScheduleFragment schedule, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (serviceFabricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (schedule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("serviceFabricName", serviceFabricName); - tracingParameters.Add("name", name); - tracingParameters.Add("schedule", schedule); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(schedule != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, 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); - } - System.Net.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; - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// 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 BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string serviceFabricName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (serviceFabricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabricName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("serviceFabricName", serviceFabricName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{serviceFabricName}", System.Uri.EscapeDataString(serviceFabricName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// List schedules in a given service fabric. - /// - /// - /// 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); - } - System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperationsExtensions.cs deleted file mode 100644 index ef5012d3fd39..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricSchedulesOperationsExtensions.cs +++ /dev/null @@ -1,475 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ServiceFabricSchedulesOperations. - /// - public static partial class ServiceFabricSchedulesOperationsExtensions - { - /// - /// List schedules in a given service fabric. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(resourceGroupName, labName, userName, serviceFabricName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List schedules in a given service fabric. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - public static Schedule Get(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, string expand = default(string)) - { - return operations.GetAsync(resourceGroupName, labName, userName, serviceFabricName, name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - public static Schedule CreateOrUpdate(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Schedule schedule) - { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, serviceFabricName, name, schedule).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, schedule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - public static void Delete(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) - { - operations.DeleteAsync(resourceGroupName, labName, userName, serviceFabricName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of schedules. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - public static Schedule Update(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, ScheduleFragment schedule) - { - return operations.UpdateAsync(resourceGroupName, labName, userName, serviceFabricName, name, schedule).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of schedules. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, schedule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - public static void Execute(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) - { - operations.ExecuteAsync(resourceGroupName, labName, userName, serviceFabricName, name).GetAwaiter().GetResult(); - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - public static void BeginExecute(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) - { - operations.BeginExecuteAsync(resourceGroupName, labName, userName, serviceFabricName, name).GetAwaiter().GetResult(); - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task BeginExecuteAsync(this IServiceFabricSchedulesOperations operations, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, userName, serviceFabricName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List schedules in a given service fabric. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IServiceFabricSchedulesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List schedules in a given service fabric. - /// - /// - /// 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 IServiceFabricSchedulesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperations.cs deleted file mode 100644 index 06490f19d3a9..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperations.cs +++ /dev/null @@ -1,2052 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs -{ - 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; - - /// - /// ServiceFabricsOperations operations. - /// - internal partial class ServiceFabricsOperations : IServiceOperations, IServiceFabricsOperations - { - /// - /// Initializes a new instance of the ServiceFabricsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ServiceFabricsOperations(DevTestLabsClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the DevTestLabsClient - /// - public DevTestLabsClient Client { get; private set; } - - /// - /// List service fabrics in a given user profile. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // 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("labName", labName); - tracingParameters.Add("userName", userName); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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 service fabric. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($expand=applicableSchedule)' - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string userName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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 replace an existing Service Fabric. This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, serviceFabric, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Delete service fabric. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Modify properties of service fabrics. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string userName, string name, ServiceFabricFragment serviceFabric, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (serviceFabric == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabric"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - tracingParameters.Add("serviceFabric", serviceFabric); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(serviceFabric != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(serviceFabric, 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); - } - System.Net.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 the applicable start/stop schedules, if any. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListApplicableSchedules", 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// Start a service fabric. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task StartWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Stop a service fabric This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task StopWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Create or replace an existing Service Fabric. This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a 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 labName, string userName, string name, ServiceFabric serviceFabric, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (serviceFabric == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceFabric"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - tracingParameters.Add("serviceFabric", serviceFabric); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(serviceFabric != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(serviceFabric, 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); - } - System.Net.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; - } - - /// - /// Delete service fabric. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 labName, string userName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// Start a service fabric. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 labName, string userName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// Stop a service fabric This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (userName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("userName", userName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginStop", 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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// List service fabrics in a given user profile. - /// - /// - /// 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); - } - System.Net.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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperationsExtensions.cs deleted file mode 100644 index 4507e03fd7b3..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceFabricsOperationsExtensions.cs +++ /dev/null @@ -1,696 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ServiceFabricsOperations. - /// - public static partial class ServiceFabricsOperationsExtensions - { - /// - /// List service fabrics in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(resourceGroupName, labName, userName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List service fabrics in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get service fabric. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($expand=applicableSchedule)' - /// - public static ServiceFabric Get(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string)) - { - return operations.GetAsync(resourceGroupName, labName, userName, name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get service fabric. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($expand=applicableSchedule)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing Service Fabric. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - public static ServiceFabric CreateOrUpdate(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric) - { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, userName, name, serviceFabric).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing Service Fabric. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, serviceFabric, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete service fabric. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - public static void Delete(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) - { - operations.DeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete service fabric. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of service fabrics. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - public static ServiceFabric Update(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabricFragment serviceFabric) - { - return operations.UpdateAsync(resourceGroupName, labName, userName, name, serviceFabric).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of service fabrics. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabricFragment serviceFabric, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, serviceFabric, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the applicable start/stop schedules, if any. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - public static ApplicableSchedule ListApplicableSchedules(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) - { - return operations.ListApplicableSchedulesAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Lists the applicable start/stop schedules, if any. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task ListApplicableSchedulesAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListApplicableSchedulesWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Start a service fabric. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - public static void Start(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) - { - operations.StartAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Start a service fabric. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task StartAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.StartWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Stop a service fabric This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - public static void Stop(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) - { - operations.StopAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Stop a service fabric This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task StopAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.StopWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Create or replace an existing Service Fabric. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - public static ServiceFabric BeginCreateOrUpdate(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, userName, name, serviceFabric).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing Service Fabric. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// A Service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, ServiceFabric serviceFabric, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, userName, name, serviceFabric, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete service fabric. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - public static void BeginDelete(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) - { - operations.BeginDeleteAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete service fabric. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Start a service fabric. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - public static void BeginStart(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) - { - operations.BeginStartAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Start a service fabric. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task BeginStartAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Stop a service fabric This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - public static void BeginStop(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name) - { - operations.BeginStopAsync(resourceGroupName, labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Stop a service fabric This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the service Fabric. - /// - /// - /// The cancellation token. - /// - public static async Task BeginStopAsync(this IServiceFabricsOperations operations, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List service fabrics in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IServiceFabricsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List service fabrics in a given user profile. - /// - /// - /// 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 IServiceFabricsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs index d436fc9eae6c..4c9d86d77c66 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs @@ -54,9 +54,6 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// List service runners in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal ServiceRunnersOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// Get service runner. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -292,15 +285,15 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -321,7 +314,6 @@ internal ServiceRunnersOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -331,7 +323,7 @@ internal ServiceRunnersOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -467,9 +459,6 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// Create or replace an existing Service runner. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -500,15 +489,15 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ServiceRunner serviceRunner, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ServiceRunner serviceRunner, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -533,7 +522,6 @@ internal ServiceRunnersOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("serviceRunner", serviceRunner); @@ -544,7 +532,7 @@ internal ServiceRunnersOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -704,9 +692,6 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// Delete service runner. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -731,15 +716,15 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -760,7 +745,6 @@ internal ServiceRunnersOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -770,7 +754,7 @@ internal ServiceRunnersOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs index 0a5496deba78..ce5de9e0f812 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class ServiceRunnersOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this IServiceRunnersOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IServiceRunnersOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class ServiceRunnersOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class ServiceRunnersOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IServiceRunnersOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IServiceRunnersOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,18 +68,15 @@ public static partial class ServiceRunnersOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the service runner. /// - public static ServiceRunner Get(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name) + public static ServiceRunner Get(this IServiceRunnersOperations operations, string labName, string name) { - return operations.GetAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -94,9 +85,6 @@ public static ServiceRunner Get(this IServiceRunnersOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -106,9 +94,9 @@ public static ServiceRunner Get(this IServiceRunnersOperations operations, strin /// /// The cancellation token. /// - public static async Task GetAsync(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IServiceRunnersOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -120,9 +108,6 @@ public static ServiceRunner Get(this IServiceRunnersOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -132,9 +117,9 @@ public static ServiceRunner Get(this IServiceRunnersOperations operations, strin /// /// A container for a managed identity to execute DevTest lab services. /// - public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name, ServiceRunner serviceRunner) + public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operations, string labName, string name, ServiceRunner serviceRunner) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, serviceRunner).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, serviceRunner).GetAwaiter().GetResult(); } /// @@ -143,9 +128,6 @@ public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operat /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -158,9 +140,9 @@ public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operat /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name, ServiceRunner serviceRunner, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IServiceRunnersOperations operations, string labName, string name, ServiceRunner serviceRunner, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, serviceRunner, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, serviceRunner, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -172,18 +154,15 @@ public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operat /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the service runner. /// - public static void Delete(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this IServiceRunnersOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -192,9 +171,6 @@ public static void Delete(this IServiceRunnersOperations operations, string reso /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -204,9 +180,9 @@ public static void Delete(this IServiceRunnersOperations operations, string reso /// /// The cancellation token. /// - public static async Task DeleteAsync(this IServiceRunnersOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IServiceRunnersOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs index cf41d091a4c5..62821da17e3c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs @@ -54,9 +54,6 @@ internal UsersOperations(DevTestLabsClient client) /// /// List user profiles in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal UsersOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal UsersOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal UsersOperations(DevTestLabsClient client) /// /// Get user profile. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -295,15 +288,15 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -324,7 +317,6 @@ internal UsersOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -335,7 +327,7 @@ internal UsersOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -473,65 +465,8 @@ internal UsersOperations(DevTestLabsClient client) } /// - /// Create or replace an existing user profile. This operation can take a while - /// to complete. + /// Create or replace an existing user profile. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Profile of a lab user. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, user, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Delete user profile. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Modify properties of user profiles. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -562,15 +497,15 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -595,18 +530,17 @@ internal UsersOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("user", user); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + 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.DevTestLab/labs/{labName}/users/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -621,7 +555,7 @@ internal UsersOperations(DevTestLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -678,7 +612,7 @@ internal UsersOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -738,6 +672,24 @@ internal UsersOperations(DevTestLabsClient client) 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); @@ -746,12 +698,30 @@ internal UsersOperations(DevTestLabsClient client) } /// - /// Create or replace an existing user profile. This operation can take a while - /// to complete. + /// Delete user profile. This operation can take a while to complete. /// - /// - /// The name of the resource group. + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The headers that will be added to request. /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of user profiles. + /// /// /// The name of the lab. /// @@ -782,15 +752,15 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string labName, string name, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -815,18 +785,17 @@ internal UsersOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("user", user); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + 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.DevTestLab/labs/{labName}/users/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -841,7 +810,7 @@ internal UsersOperations(DevTestLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -898,7 +867,7 @@ internal UsersOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -958,24 +927,6 @@ internal UsersOperations(DevTestLabsClient client) 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); @@ -986,9 +937,6 @@ internal UsersOperations(DevTestLabsClient client) /// /// Delete user profile. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1013,15 +961,15 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1042,7 +990,6 @@ internal UsersOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1052,7 +999,7 @@ internal UsersOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -1118,7 +1065,7 @@ internal UsersOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs index dbafd0da6ced..1e378fdd80b9 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class UsersOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this IUsersOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IUsersOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class UsersOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class UsersOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IUsersOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IUsersOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,9 +68,6 @@ public static partial class UsersOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,9 +77,9 @@ public static partial class UsersOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=identity)' /// - public static User Get(this IUsersOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static User Get(this IUsersOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -97,9 +88,6 @@ public static partial class UsersOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -112,24 +100,20 @@ public static partial class UsersOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IUsersOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Create or replace an existing user profile. This operation can take a while - /// to complete. + /// Create or replace an existing user profile. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -139,21 +123,17 @@ public static partial class UsersOperationsExtensions /// /// Profile of a lab user. /// - public static User CreateOrUpdate(this IUsersOperations operations, string resourceGroupName, string labName, string name, User user) + public static User CreateOrUpdate(this IUsersOperations operations, string labName, string name, User user) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, user).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, user).GetAwaiter().GetResult(); } /// - /// Create or replace an existing user profile. This operation can take a while - /// to complete. + /// Create or replace an existing user profile. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -166,9 +146,9 @@ public static User CreateOrUpdate(this IUsersOperations operations, string resou /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, User user, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IUsersOperations operations, string labName, string name, User user, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, user, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, user, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -180,18 +160,15 @@ public static User CreateOrUpdate(this IUsersOperations operations, string resou /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the user profile. /// - public static void Delete(this IUsersOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this IUsersOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -200,9 +177,6 @@ public static void Delete(this IUsersOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -212,9 +186,9 @@ public static void Delete(this IUsersOperations operations, string resourceGroup /// /// The cancellation token. /// - public static async Task DeleteAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IUsersOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -223,9 +197,6 @@ public static void Delete(this IUsersOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -235,9 +206,9 @@ public static void Delete(this IUsersOperations operations, string resourceGroup /// /// Profile of a lab user. /// - public static User Update(this IUsersOperations operations, string resourceGroupName, string labName, string name, UserFragment user) + public static User Update(this IUsersOperations operations, string labName, string name, UserFragment user) { - return operations.UpdateAsync(resourceGroupName, labName, name, user).GetAwaiter().GetResult(); + return operations.UpdateAsync(labName, name, user).GetAwaiter().GetResult(); } /// @@ -246,63 +217,6 @@ public static User Update(this IUsersOperations operations, string resourceGroup /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Profile of a lab user. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, UserFragment user, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, user, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing user profile. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Profile of a lab user. - /// - public static User BeginCreateOrUpdate(this IUsersOperations operations, string resourceGroupName, string labName, string name, User user) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, user).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing user profile. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -315,9 +229,9 @@ public static User BeginCreateOrUpdate(this IUsersOperations operations, string /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, User user, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IUsersOperations operations, string labName, string name, UserFragment user, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, user, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, user, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -329,18 +243,15 @@ public static User BeginCreateOrUpdate(this IUsersOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the user profile. /// - public static void BeginDelete(this IUsersOperations operations, string resourceGroupName, string labName, string name) + public static void BeginDelete(this IUsersOperations operations, string labName, string name) { - operations.BeginDeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -349,9 +260,6 @@ public static void BeginDelete(this IUsersOperations operations, string resource /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -361,9 +269,9 @@ public static void BeginDelete(this IUsersOperations operations, string resource /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IUsersOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IUsersOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs index e368d86af620..bc8a484b70a2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs @@ -54,9 +54,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// List schedules in a given virtual machine. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -87,15 +84,15 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -117,7 +114,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,7 +123,7 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); List _queryParameters = new List(); @@ -271,9 +267,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// Get schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -307,15 +300,15 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string virtualMachineName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -340,7 +333,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); @@ -352,7 +344,7 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -493,9 +485,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// Create or replace an existing schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -529,15 +518,15 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -566,7 +555,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); @@ -578,7 +566,7 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -739,9 +727,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// Delete schedule. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -769,15 +754,15 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -802,7 +787,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); @@ -813,7 +797,7 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -932,9 +916,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// Modify properties of schedules. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -968,15 +949,15 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1005,7 +986,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); @@ -1017,7 +997,7 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); @@ -1160,9 +1140,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1178,19 +1155,16 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task ExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Execute a schedule. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1218,15 +1192,15 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginExecuteWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1251,7 +1225,6 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); @@ -1262,7 +1235,7 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs index 75a38f17fbf6..d7037f393f6a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs @@ -28,9 +28,6 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -40,9 +37,9 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage List(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, virtualMachineName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, virtualMachineName, odataQuery).GetAwaiter().GetResult(); } /// @@ -51,9 +48,6 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -66,9 +60,9 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, virtualMachineName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -80,9 +74,6 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -95,9 +86,9 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// Specify the $expand query. Example: 'properties($select=status)' /// - public static Schedule Get(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, string expand = default(string)) + public static Schedule Get(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, virtualMachineName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, virtualMachineName, name, expand).GetAwaiter().GetResult(); } /// @@ -106,9 +97,6 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -124,9 +112,9 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, virtualMachineName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -138,9 +126,6 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -153,9 +138,9 @@ public static partial class VirtualMachineSchedulesOperationsExtensions /// /// A schedule. /// - public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, Schedule schedule) + public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, Schedule schedule) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); } /// @@ -164,9 +149,6 @@ public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations op /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -182,9 +164,9 @@ public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations op /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -196,9 +178,6 @@ public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations op /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -208,9 +187,9 @@ public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations op /// /// The name of the schedule. /// - public static void Delete(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name) + public static void Delete(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) { - operations.DeleteAsync(resourceGroupName, labName, virtualMachineName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); } /// @@ -219,9 +198,6 @@ public static void Delete(this IVirtualMachineSchedulesOperations operations, st /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -234,9 +210,9 @@ public static void Delete(this IVirtualMachineSchedulesOperations operations, st /// /// The cancellation token. /// - public static async Task DeleteAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -245,9 +221,6 @@ public static void Delete(this IVirtualMachineSchedulesOperations operations, st /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -260,9 +233,9 @@ public static void Delete(this IVirtualMachineSchedulesOperations operations, st /// /// A schedule. /// - public static Schedule Update(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, ScheduleFragment schedule) + public static Schedule Update(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, ScheduleFragment schedule) { - return operations.UpdateAsync(resourceGroupName, labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + return operations.UpdateAsync(labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); } /// @@ -271,9 +244,6 @@ public static Schedule Update(this IVirtualMachineSchedulesOperations operations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -289,9 +259,9 @@ public static Schedule Update(this IVirtualMachineSchedulesOperations operations /// /// The cancellation token. /// - public static async Task UpdateAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -303,9 +273,6 @@ public static Schedule Update(this IVirtualMachineSchedulesOperations operations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -315,9 +282,9 @@ public static Schedule Update(this IVirtualMachineSchedulesOperations operations /// /// The name of the schedule. /// - public static void Execute(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name) + public static void Execute(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) { - operations.ExecuteAsync(resourceGroupName, labName, virtualMachineName, name).GetAwaiter().GetResult(); + operations.ExecuteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); } /// @@ -326,9 +293,6 @@ public static void Execute(this IVirtualMachineSchedulesOperations operations, s /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -341,9 +305,9 @@ public static void Execute(this IVirtualMachineSchedulesOperations operations, s /// /// The cancellation token. /// - public static async Task ExecuteAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExecuteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ExecuteWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -352,9 +316,6 @@ public static void Execute(this IVirtualMachineSchedulesOperations operations, s /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -364,9 +325,9 @@ public static void Execute(this IVirtualMachineSchedulesOperations operations, s /// /// The name of the schedule. /// - public static void BeginExecute(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name) + public static void BeginExecute(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) { - operations.BeginExecuteAsync(resourceGroupName, labName, virtualMachineName, name).GetAwaiter().GetResult(); + operations.BeginExecuteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); } /// @@ -375,9 +336,6 @@ public static void BeginExecute(this IVirtualMachineSchedulesOperations operatio /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -390,9 +348,9 @@ public static void BeginExecute(this IVirtualMachineSchedulesOperations operatio /// /// The cancellation token. /// - public static async Task BeginExecuteAsync(this IVirtualMachineSchedulesOperations operations, string resourceGroupName, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginExecuteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginExecuteWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs index 4b46d6ef003e..4b8815079797 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs @@ -54,9 +54,6 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// List virtual machines in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// Get virtual machine. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -296,15 +289,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -325,7 +318,6 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -336,7 +328,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -477,9 +469,6 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// Create or replace an existing Virtual machine. This operation can take a /// while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -495,19 +484,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labVirtualMachine, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Delete virtual machine. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -520,19 +506,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Modify properties of virtual machines. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -563,15 +546,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachineFragment labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -596,7 +579,6 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("labVirtualMachine", labVirtualMachine); @@ -607,7 +589,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -750,9 +732,6 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// Attach a new or existing data disk to virtual machine. This operation can /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -768,10 +747,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task AddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task AddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginAddDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, dataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginAddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -779,9 +758,6 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// Apply artifacts to virtual machine. This operation can take a while to /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -797,1486 +773,65 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task ApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, applyArtifactsRequest, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Take ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task ClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginClaimWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Detach the specified disk from the virtual machine. This operation can take - /// a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for detaching data disk from a virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDetachDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, detachDataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a string that represents the contents of the RDP file for the virtual - /// machine - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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> GetRdpFileContentsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRdpFileContents", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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 the applicable start/stop schedules, if any. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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> ListApplicableSchedulesWithHttpMessagesAsync(string resourceGroupName, string labName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListApplicableSchedules", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// Redeploy a virtual machine This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Resize Virtual Machine. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for resizing a virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task ResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginResizeWithHttpMessagesAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Restart a virtual machine. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Start a virtual machine. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task StartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Stop a virtual machine This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task StopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Transfers all data disks attached to the virtual machine to be owned by the - /// current user. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task TransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginTransferDisksWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Release ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task UnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginUnClaimWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Create or replace an existing Virtual machine. This operation can take a - /// while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// A 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (labVirtualMachine == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labVirtualMachine"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("labVirtualMachine", labVirtualMachine); - 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.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(labVirtualMachine != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, 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); - } - System.Net.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; - } - - /// - /// Delete virtual machine. This operation can take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// 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 labName, string name, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - 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.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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); - } - System.Net.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; - } - - /// - /// Attach a new or existing data disk to virtual machine. This operation can - /// take a while to complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for adding a new or existing data disk to a 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 BeginAddDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (dataDiskProperties == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataDiskProperties"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("dataDiskProperties", dataDiskProperties); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginAddDataDisk", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(dataDiskProperties != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataDiskProperties, 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); - } - System.Net.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; - } - - /// - /// Apply artifacts to virtual machine. This operation can take a while to - /// complete. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for applying artifacts to a 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 BeginApplyArtifactsWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, 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 (labName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (applyArtifactsRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "applyArtifactsRequest"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("name", name); - tracingParameters.Add("applyArtifactsRequest", applyArtifactsRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginApplyArtifacts", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_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(applyArtifactsRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(applyArtifactsRequest, 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); - } - System.Net.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; + // Send request + AzureOperationResponse _response = await BeginApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Take ownership of an existing virtual machine This operation can take a /// while to complete. /// - /// - /// The name of the resource group. + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ClaimWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginClaimWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. /// + public async Task DetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all applicable schedules + /// /// /// The name of the lab. /// @@ -2292,6 +847,9 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -2301,15 +859,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListApplicableSchedulesWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -2330,17 +888,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginClaim", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListApplicableSchedules", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/claim").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -2406,7 +963,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2441,13 +998,31 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2456,20 +1031,61 @@ internal VirtualMachinesOperations(DevTestLabsClient client) } /// - /// Detach the specified disk from the virtual machine. This operation can take - /// a while to complete. + /// Start a virtual machine. This operation can take a while to complete. /// - /// - /// The name of the resource group. + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - /// - /// Request body for detaching data disk from a virtual machine. + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StopWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. /// /// /// Headers that will be added to request. @@ -2480,6 +1096,9 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -2489,15 +1108,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDetachDataDiskWithHttpMessagesAsync(string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -2507,9 +1126,9 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (detachDataDiskProperties == null) + if (labVirtualMachine == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "detachDataDiskProperties"); + throw new ValidationException(ValidationRules.CannotBeNull, "labVirtualMachine"); } if (Client.ApiVersion == null) { @@ -2522,18 +1141,17 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); - tracingParameters.Add("detachDataDiskProperties", detachDataDiskProperties); + tracingParameters.Add("labVirtualMachine", labVirtualMachine); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDetachDataDisk", tracingParameters); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -2548,7 +1166,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2579,9 +1197,9 @@ internal VirtualMachinesOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; - if(detachDataDiskProperties != null) + if(labVirtualMachine != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(detachDataDiskProperties, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, 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"); } @@ -2605,7 +1223,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2640,13 +1258,49 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.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); @@ -2655,11 +1309,8 @@ internal VirtualMachinesOperations(DevTestLabsClient client) } /// - /// Redeploy a virtual machine This operation can take a while to complete. + /// Delete virtual machine. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -2684,15 +1335,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -2713,17 +1364,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginRedeploy", tracingParameters); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -2738,7 +1388,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2789,7 +1439,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2839,19 +1489,17 @@ internal VirtualMachinesOperations(DevTestLabsClient client) } /// - /// Resize Virtual Machine. This operation can take a while to complete. + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - /// - /// Request body for resizing a virtual machine. + /// + /// Request body for adding a new or existing data disk to a virtual machine. /// /// /// Headers that will be added to request. @@ -2871,15 +1519,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginResizeWithHttpMessagesAsync(string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginAddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -2889,9 +1537,9 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (resizeLabVirtualMachineProperties == null) + if (dataDiskProperties == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resizeLabVirtualMachineProperties"); + throw new ValidationException(ValidationRules.CannotBeNull, "dataDiskProperties"); } if (Client.ApiVersion == null) { @@ -2904,18 +1552,17 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); - tracingParameters.Add("resizeLabVirtualMachineProperties", resizeLabVirtualMachineProperties); + tracingParameters.Add("dataDiskProperties", dataDiskProperties); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginResize", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginAddDataDisk", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/resize").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -2961,9 +1608,9 @@ internal VirtualMachinesOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; - if(resizeLabVirtualMachineProperties != null) + if(dataDiskProperties != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(resizeLabVirtualMachineProperties, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataDiskProperties, 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"); } @@ -3037,17 +1684,18 @@ internal VirtualMachinesOperations(DevTestLabsClient client) } /// - /// Restart a virtual machine. This operation can take a while to complete. + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// + /// + /// Request body for applying artifacts to a virtual machine. + /// /// /// Headers that will be added to request. /// @@ -3066,15 +1714,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -3084,6 +1732,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } + if (applyArtifactsRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applyArtifactsRequest"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -3095,17 +1747,17 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("applyArtifactsRequest", applyArtifactsRequest); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginApplyArtifacts", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/restart").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -3151,6 +1803,12 @@ internal VirtualMachinesOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; + if(applyArtifactsRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(applyArtifactsRequest, 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) { @@ -3221,11 +1879,9 @@ internal VirtualMachinesOperations(DevTestLabsClient client) } /// - /// Start a virtual machine. This operation can take a while to complete. + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -3250,15 +1906,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginClaimWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -3279,17 +1935,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginClaim", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/start").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -3405,17 +2060,18 @@ internal VirtualMachinesOperations(DevTestLabsClient client) } /// - /// Stop a virtual machine This operation can take a while to complete. + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// + /// + /// Request body for detaching data disk from a virtual machine. + /// /// /// Headers that will be added to request. /// @@ -3434,15 +2090,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -3452,6 +2108,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } + if (detachDataDiskProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "detachDataDiskProperties"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -3463,17 +2123,17 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("detachDataDiskProperties", detachDataDiskProperties); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginStop", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginDetachDataDisk", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/stop").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -3519,6 +2179,12 @@ internal VirtualMachinesOperations(DevTestLabsClient client) // Serialize Request string _requestContent = null; + if(detachDataDiskProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(detachDataDiskProperties, 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) { @@ -3589,12 +2255,8 @@ internal VirtualMachinesOperations(DevTestLabsClient client) } /// - /// Transfers all data disks attached to the virtual machine to be owned by the - /// current user. This operation can take a while to complete. + /// Start a virtual machine. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -3619,15 +2281,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginTransferDisksWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginStartWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -3648,17 +2310,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginTransferDisks", tracingParameters); + 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.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -3774,12 +2435,8 @@ internal VirtualMachinesOperations(DevTestLabsClient client) } /// - /// Release ownership of an existing virtual machine This operation can take a - /// while to complete. + /// Stop a virtual machine This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -3804,15 +2461,15 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginUnClaimWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginStopWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -3833,17 +2490,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUnClaim", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginStop", 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.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs index 11bf99f21bbe..41162ddce27c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class VirtualMachinesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IVirtualMachinesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class VirtualMachinesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class VirtualMachinesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IVirtualMachinesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,9 +68,6 @@ public static partial class VirtualMachinesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -87,9 +78,9 @@ public static partial class VirtualMachinesOperationsExtensions /// Specify the $expand query. Example: /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' /// - public static LabVirtualMachine Get(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static LabVirtualMachine Get(this IVirtualMachinesOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -98,9 +89,6 @@ public static partial class VirtualMachinesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -114,9 +102,9 @@ public static partial class VirtualMachinesOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IVirtualMachinesOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -129,9 +117,6 @@ public static partial class VirtualMachinesOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -141,9 +126,9 @@ public static partial class VirtualMachinesOperationsExtensions /// /// A virtual machine. /// - public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine) + public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); } /// @@ -153,9 +138,6 @@ public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations o /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -168,9 +150,9 @@ public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations o /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -182,18 +164,15 @@ public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations o /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static void Delete(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this IVirtualMachinesOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -202,9 +181,6 @@ public static void Delete(this IVirtualMachinesOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -214,9 +190,9 @@ public static void Delete(this IVirtualMachinesOperations operations, string res /// /// The cancellation token. /// - public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -225,9 +201,6 @@ public static void Delete(this IVirtualMachinesOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -237,9 +210,9 @@ public static void Delete(this IVirtualMachinesOperations operations, string res /// /// A virtual machine. /// - public static LabVirtualMachine Update(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine) + public static LabVirtualMachine Update(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachineFragment labVirtualMachine) { - return operations.UpdateAsync(resourceGroupName, labName, name, labVirtualMachine).GetAwaiter().GetResult(); + return operations.UpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); } /// @@ -248,9 +221,6 @@ public static LabVirtualMachine Update(this IVirtualMachinesOperations operation /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -263,9 +233,9 @@ public static LabVirtualMachine Update(this IVirtualMachinesOperations operation /// /// The cancellation token. /// - public static async Task UpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachineFragment labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachineFragment labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -278,9 +248,6 @@ public static LabVirtualMachine Update(this IVirtualMachinesOperations operation /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -290,9 +257,9 @@ public static LabVirtualMachine Update(this IVirtualMachinesOperations operation /// /// Request body for adding a new or existing data disk to a virtual machine. /// - public static void AddDataDisk(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties) + public static void AddDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties) { - operations.AddDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties).GetAwaiter().GetResult(); + operations.AddDataDiskAsync(labName, name, dataDiskProperties).GetAwaiter().GetResult(); } /// @@ -302,9 +269,6 @@ public static void AddDataDisk(this IVirtualMachinesOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -317,9 +281,9 @@ public static void AddDataDisk(this IVirtualMachinesOperations operations, strin /// /// The cancellation token. /// - public static async Task AddDataDiskAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AddDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.AddDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.AddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -329,9 +293,6 @@ public static void AddDataDisk(this IVirtualMachinesOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -341,9 +302,9 @@ public static void AddDataDisk(this IVirtualMachinesOperations operations, strin /// /// Request body for applying artifacts to a virtual machine. /// - public static void ApplyArtifacts(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) + public static void ApplyArtifacts(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) { - operations.ApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); + operations.ApplyArtifactsAsync(labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); } /// @@ -353,9 +314,6 @@ public static void ApplyArtifacts(this IVirtualMachinesOperations operations, st /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -368,9 +326,9 @@ public static void ApplyArtifacts(this IVirtualMachinesOperations operations, st /// /// The cancellation token. /// - public static async Task ApplyArtifactsAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ApplyArtifactsAsync(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -380,18 +338,15 @@ public static void ApplyArtifacts(this IVirtualMachinesOperations operations, st /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static void Claim(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static void Claim(this IVirtualMachinesOperations operations, string labName, string name) { - operations.ClaimAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.ClaimAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -401,9 +356,6 @@ public static void Claim(this IVirtualMachinesOperations operations, string reso /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -413,9 +365,9 @@ public static void Claim(this IVirtualMachinesOperations operations, string reso /// /// The cancellation token. /// - public static async Task ClaimAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ClaimAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ClaimWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ClaimWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -425,9 +377,6 @@ public static void Claim(this IVirtualMachinesOperations operations, string reso /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -437,9 +386,9 @@ public static void Claim(this IVirtualMachinesOperations operations, string reso /// /// Request body for detaching data disk from a virtual machine. /// - public static void DetachDataDisk(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) + public static void DetachDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) { - operations.DetachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); + operations.DetachDataDiskAsync(labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); } /// @@ -449,9 +398,6 @@ public static void DetachDataDisk(this IVirtualMachinesOperations operations, st /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -464,88 +410,34 @@ public static void DetachDataDisk(this IVirtualMachinesOperations operations, st /// /// The cancellation token. /// - public static async Task DetachDataDiskAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DetachDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a string that represents the contents of the RDP file for the virtual - /// machine - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static RdpConnection GetRdpFileContents(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - return operations.GetRdpFileContentsAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Gets a string that represents the contents of the RDP file for the virtual - /// machine - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task GetRdpFileContentsAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DetachDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetRdpFileContentsWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Lists the applicable start/stop schedules, if any. + /// Lists all applicable schedules /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static ApplicableSchedule ListApplicableSchedules(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static ApplicableSchedule ListApplicableSchedules(this IVirtualMachinesOperations operations, string labName, string name) { - return operations.ListApplicableSchedulesAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + return operations.ListApplicableSchedulesAsync(labName, name).GetAwaiter().GetResult(); } /// - /// Lists the applicable start/stop schedules, if any. + /// Lists all applicable schedules /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -555,167 +447,29 @@ public static ApplicableSchedule ListApplicableSchedules(this IVirtualMachinesOp /// /// The cancellation token. /// - public static async Task ListApplicableSchedulesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListApplicableSchedulesAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListApplicableSchedulesWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListApplicableSchedulesWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } - /// - /// Redeploy a virtual machine This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void Redeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - operations.RedeployAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Redeploy a virtual machine This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task RedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Resize Virtual Machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for resizing a virtual machine. - /// - public static void Resize(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) - { - operations.ResizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties).GetAwaiter().GetResult(); - } - - /// - /// Resize Virtual Machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for resizing a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task ResizeAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ResizeWithHttpMessagesAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Restart a virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void Restart(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - operations.RestartAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Restart a virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task RestartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.RestartWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// Start a virtual machine. This operation can take a while to complete. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static void Start(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static void Start(this IVirtualMachinesOperations operations, string labName, string name) { - operations.StartAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.StartAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -724,9 +478,6 @@ public static void Start(this IVirtualMachinesOperations operations, string reso /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -736,9 +487,9 @@ public static void Start(this IVirtualMachinesOperations operations, string reso /// /// The cancellation token. /// - public static async Task StartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task StartAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.StartWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.StartWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -747,18 +498,15 @@ public static void Start(this IVirtualMachinesOperations operations, string reso /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static void Stop(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static void Stop(this IVirtualMachinesOperations operations, string labName, string name) { - operations.StopAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.StopAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -767,99 +515,6 @@ public static void Stop(this IVirtualMachinesOperations operations, string resou /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task StopAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.StopWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Transfers all data disks attached to the virtual machine to be owned by the - /// current user. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void TransferDisks(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - operations.TransferDisksAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Transfers all data disks attached to the virtual machine to be owned by the - /// current user. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task TransferDisksAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.TransferDisksWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Release ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void UnClaim(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - operations.UnClaimAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Release ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -869,9 +524,9 @@ public static void UnClaim(this IVirtualMachinesOperations operations, string re /// /// The cancellation token. /// - public static async Task UnClaimAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task StopAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UnClaimWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.StopWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -881,9 +536,6 @@ public static void UnClaim(this IVirtualMachinesOperations operations, string re /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -893,9 +545,9 @@ public static void UnClaim(this IVirtualMachinesOperations operations, string re /// /// A virtual machine. /// - public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine) + public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); } /// @@ -905,9 +557,6 @@ public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperati /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -920,9 +569,9 @@ public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperati /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, LabVirtualMachine labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -934,18 +583,15 @@ public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperati /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static void BeginDelete(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static void BeginDelete(this IVirtualMachinesOperations operations, string labName, string name) { - operations.BeginDeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -954,9 +600,6 @@ public static void BeginDelete(this IVirtualMachinesOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -966,9 +609,9 @@ public static void BeginDelete(this IVirtualMachinesOperations operations, strin /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -978,9 +621,6 @@ public static void BeginDelete(this IVirtualMachinesOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -990,9 +630,9 @@ public static void BeginDelete(this IVirtualMachinesOperations operations, strin /// /// Request body for adding a new or existing data disk to a virtual machine. /// - public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties) + public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties) { - operations.BeginAddDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties).GetAwaiter().GetResult(); + operations.BeginAddDataDiskAsync(labName, name, dataDiskProperties).GetAwaiter().GetResult(); } /// @@ -1002,9 +642,6 @@ public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1017,9 +654,9 @@ public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, /// /// The cancellation token. /// - public static async Task BeginAddDataDiskAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginAddDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginAddDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginAddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1029,9 +666,6 @@ public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1041,9 +675,9 @@ public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, /// /// Request body for applying artifacts to a virtual machine. /// - public static void BeginApplyArtifacts(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) + public static void BeginApplyArtifacts(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) { - operations.BeginApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); + operations.BeginApplyArtifactsAsync(labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); } /// @@ -1053,9 +687,6 @@ public static void BeginApplyArtifacts(this IVirtualMachinesOperations operation /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1068,9 +699,9 @@ public static void BeginApplyArtifacts(this IVirtualMachinesOperations operation /// /// The cancellation token. /// - public static async Task BeginApplyArtifactsAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginApplyArtifactsAsync(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginApplyArtifactsWithHttpMessagesAsync(resourceGroupName, labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1080,18 +711,15 @@ public static void BeginApplyArtifacts(this IVirtualMachinesOperations operation /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static void BeginClaim(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static void BeginClaim(this IVirtualMachinesOperations operations, string labName, string name) { - operations.BeginClaimAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.BeginClaimAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -1101,9 +729,6 @@ public static void BeginClaim(this IVirtualMachinesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1113,9 +738,9 @@ public static void BeginClaim(this IVirtualMachinesOperations operations, string /// /// The cancellation token. /// - public static async Task BeginClaimAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginClaimAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginClaimWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginClaimWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1125,9 +750,6 @@ public static void BeginClaim(this IVirtualMachinesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1137,9 +759,9 @@ public static void BeginClaim(this IVirtualMachinesOperations operations, string /// /// Request body for detaching data disk from a virtual machine. /// - public static void BeginDetachDataDisk(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) + public static void BeginDetachDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) { - operations.BeginDetachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); + operations.BeginDetachDataDiskAsync(labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); } /// @@ -1149,9 +771,6 @@ public static void BeginDetachDataDisk(this IVirtualMachinesOperations operation /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1164,144 +783,9 @@ public static void BeginDetachDataDisk(this IVirtualMachinesOperations operation /// /// The cancellation token. /// - public static async Task BeginDetachDataDiskAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDetachDataDiskWithHttpMessagesAsync(resourceGroupName, labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Redeploy a virtual machine This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void BeginRedeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - operations.BeginRedeployAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Redeploy a virtual machine This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginRedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Resize Virtual Machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for resizing a virtual machine. - /// - public static void BeginResize(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) - { - operations.BeginResizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties).GetAwaiter().GetResult(); - } - - /// - /// Resize Virtual Machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for resizing a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginResizeAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDetachDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginResizeWithHttpMessagesAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Restart a virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void BeginRestart(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - operations.BeginRestartAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Restart a virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginRestartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1310,18 +794,15 @@ public static void BeginRestart(this IVirtualMachinesOperations operations, stri /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static void BeginStart(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static void BeginStart(this IVirtualMachinesOperations operations, string labName, string name) { - operations.BeginStartAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.BeginStartAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -1330,9 +811,6 @@ public static void BeginStart(this IVirtualMachinesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1342,9 +820,9 @@ public static void BeginStart(this IVirtualMachinesOperations operations, string /// /// The cancellation token. /// - public static async Task BeginStartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginStartAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginStartWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1353,18 +831,15 @@ public static void BeginStart(this IVirtualMachinesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - public static void BeginStop(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) + public static void BeginStop(this IVirtualMachinesOperations operations, string labName, string name) { - operations.BeginStopAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.BeginStopAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -1373,99 +848,6 @@ public static void BeginStop(this IVirtualMachinesOperations operations, string /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginStopAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Transfers all data disks attached to the virtual machine to be owned by the - /// current user. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void BeginTransferDisks(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - operations.BeginTransferDisksAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Transfers all data disks attached to the virtual machine to be owned by the - /// current user. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginTransferDisksAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginTransferDisksWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Release ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void BeginUnClaim(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name) - { - operations.BeginUnClaimAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); - } - - /// - /// Release ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1475,9 +857,9 @@ public static void BeginUnClaim(this IVirtualMachinesOperations operations, stri /// /// The cancellation token. /// - public static async Task BeginUnClaimAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginStopAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginUnClaimWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginStopWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs index 01098e514910..07911d8bfc88 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs @@ -54,9 +54,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// List virtual networks in a given lab. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -84,15 +81,15 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -110,7 +107,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -119,7 +115,7 @@ internal VirtualNetworksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); List _queryParameters = new List(); if (odataQuery != null) @@ -262,9 +258,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// Get virtual network. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -295,15 +288,15 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string labName, string name, 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) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -324,7 +317,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); @@ -335,7 +327,7 @@ internal VirtualNetworksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -476,9 +468,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// Create or replace an existing virtual network. This operation can take a /// while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -494,19 +483,16 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, virtualNetwork, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Delete virtual network. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -519,19 +505,16 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Modify properties of virtual networks. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -562,15 +545,15 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, VirtualNetworkFragment virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string labName, string name, VirtualNetworkFragment virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -595,7 +578,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("virtualNetwork", virtualNetwork); @@ -606,7 +588,7 @@ internal VirtualNetworksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -749,9 +731,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// Create or replace an existing virtual network. This operation can take a /// while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -782,15 +761,15 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -815,7 +794,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("virtualNetwork", virtualNetwork); @@ -826,7 +804,7 @@ internal VirtualNetworksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -986,9 +964,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// Delete virtual network. This operation can take a while to complete. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -1013,15 +988,15 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } if (labName == null) { @@ -1042,7 +1017,6 @@ internal VirtualNetworksOperations(DevTestLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1052,7 +1026,7 @@ internal VirtualNetworksOperations(DevTestLabsClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); List _queryParameters = new List(); @@ -1118,7 +1092,7 @@ internal VirtualNetworksOperations(DevTestLabsClient client) System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs index cc8334a6dd40..e9850feacb55 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs @@ -28,18 +28,15 @@ public static partial class VirtualNetworksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// OData parameters to apply to the operation. /// - public static IPage List(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage List(this IVirtualNetworksOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListAsync(resourceGroupName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); } /// @@ -48,9 +45,6 @@ public static partial class VirtualNetworksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -60,9 +54,9 @@ public static partial class VirtualNetworksOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IVirtualNetworksOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -74,9 +68,6 @@ public static partial class VirtualNetworksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -86,9 +77,9 @@ public static partial class VirtualNetworksOperationsExtensions /// /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' /// - public static VirtualNetwork Get(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, string expand = default(string)) + public static VirtualNetwork Get(this IVirtualNetworksOperations operations, string labName, string name, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, labName, name, expand).GetAwaiter().GetResult(); + return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); } /// @@ -97,9 +88,6 @@ public static partial class VirtualNetworksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -112,9 +100,9 @@ public static partial class VirtualNetworksOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IVirtualNetworksOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -127,9 +115,6 @@ public static partial class VirtualNetworksOperationsExtensions /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -139,9 +124,9 @@ public static partial class VirtualNetworksOperationsExtensions /// /// A virtual network. /// - public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork) + public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork) { - return operations.CreateOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); } /// @@ -151,9 +136,6 @@ public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations oper /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -166,9 +148,9 @@ public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations oper /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -180,18 +162,15 @@ public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations oper /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual network. /// - public static void Delete(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name) + public static void Delete(this IVirtualNetworksOperations operations, string labName, string name) { - operations.DeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -200,9 +179,6 @@ public static void Delete(this IVirtualNetworksOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -212,9 +188,9 @@ public static void Delete(this IVirtualNetworksOperations operations, string res /// /// The cancellation token. /// - public static async Task DeleteAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IVirtualNetworksOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -223,9 +199,6 @@ public static void Delete(this IVirtualNetworksOperations operations, string res /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -235,9 +208,9 @@ public static void Delete(this IVirtualNetworksOperations operations, string res /// /// A virtual network. /// - public static VirtualNetwork Update(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetworkFragment virtualNetwork) + public static VirtualNetwork Update(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetworkFragment virtualNetwork) { - return operations.UpdateAsync(resourceGroupName, labName, name, virtualNetwork).GetAwaiter().GetResult(); + return operations.UpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); } /// @@ -246,9 +219,6 @@ public static VirtualNetwork Update(this IVirtualNetworksOperations operations, /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -261,9 +231,9 @@ public static VirtualNetwork Update(this IVirtualNetworksOperations operations, /// /// The cancellation token. /// - public static async Task UpdateAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetworkFragment virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetworkFragment virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -276,9 +246,6 @@ public static VirtualNetwork Update(this IVirtualNetworksOperations operations, /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -288,9 +255,9 @@ public static VirtualNetwork Update(this IVirtualNetworksOperations operations, /// /// A virtual network. /// - public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork) + public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); } /// @@ -300,9 +267,6 @@ public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -315,9 +279,9 @@ public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, VirtualNetwork virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -329,18 +293,15 @@ public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// /// /// The name of the virtual network. /// - public static void BeginDelete(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name) + public static void BeginDelete(this IVirtualNetworksOperations operations, string labName, string name) { - operations.BeginDeleteAsync(resourceGroupName, labName, name).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); } /// @@ -349,9 +310,6 @@ public static void BeginDelete(this IVirtualNetworksOperations operations, strin /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// /// The name of the lab. /// @@ -361,9 +319,9 @@ public static void BeginDelete(this IVirtualNetworksOperations operations, strin /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IVirtualNetworksOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md index 633bcc4c89af..0f423853b479 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md @@ -24,11 +24,23 @@ license-header: MICROSOFT_MIT_NO_VERSION ### ``` yaml -commit: d4365e634050481a5d6966cd6dd2e4a361d519dd +commit: d8a796d42bbe9456e3de85c37d3e1a38f4026d01 input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/DTL.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2016-05-15/DTL.json output-folder: Generated namespace: Microsoft.Azure.Management.DevTestLabs + +directive: + - from: swagger-document + where: $.parameters.resourceGroupName + transform: >- + return { + "name": "resourceGroupName", + "in": "path", + "description": "The name of the resource group.", + "required": true, + "type": "string" + } ``` \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs/Az.DevTestLabs.psd1 b/src/DevTestLabs/DevTestLabs/Az.DevTestLabs.psd1 index abe1b3e78784..793b640add83 100644 --- a/src/DevTestLabs/DevTestLabs/Az.DevTestLabs.psd1 +++ b/src/DevTestLabs/DevTestLabs/Az.DevTestLabs.psd1 @@ -56,7 +56,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '3.0.0'; }) # Assemblies that must be loaded prior to importing this module -RequiredAssemblies = 'Microsoft.Azure.Management.DevTestLabs.dll' +RequiredAssemblies = 'Microsoft.Azure.PowerShell.DevTestLabs.Management.Sdk.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() From 19be19abd283ae844d2c4aca225625bcb69fdc3c Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:27:02 +0800 Subject: [PATCH 4/8] migrate DevTestLabs to autorest.powershell --- .../Generated/ArmTemplatesOperations.cs | 357 ++-- .../ArmTemplatesOperationsExtensions.cs | 259 ++- .../Generated/ArtifactSourcesOperations.cs | 716 ++++--- .../ArtifactSourcesOperationsExtensions.cs | 464 +++-- .../Generated/ArtifactsOperations.cs | 487 ++--- .../ArtifactsOperationsExtensions.cs | 354 ++-- .../Generated/CostsOperations.cs | 278 +-- .../Generated/CostsOperationsExtensions.cs | 179 +- .../Generated/CustomImagesOperations.cs | 613 +++--- .../CustomImagesOperationsExtensions.cs | 543 +++--- .../Generated/DevTestLabsClient.cs | 293 ++- .../Generated/DisksOperations.cs | 886 +++++---- .../Generated/DisksOperationsExtensions.cs | 987 +++++----- .../Generated/EnvironmentsOperations.cs | 622 +++--- .../EnvironmentsOperationsExtensions.cs | 619 +++--- .../Generated/FormulasOperations.cs | 600 +++--- .../Generated/FormulasOperationsExtensions.cs | 472 +++-- .../Generated/GalleryImagesOperations.cs | 234 +-- .../GalleryImagesOperationsExtensions.cs | 150 +- .../Generated/GlobalSchedulesOperations.cs | 1125 ++++++----- .../GlobalSchedulesOperationsExtensions.cs | 782 ++++---- .../Generated/IArmTemplatesOperations.cs | 53 +- .../Generated/IArtifactSourcesOperations.cs | 80 +- .../Generated/IArtifactsOperations.cs | 67 +- .../Generated/ICostsOperations.cs | 37 +- .../Generated/ICustomImagesOperations.cs | 98 +- .../Generated/IDevTestLabsClient.cs | 92 +- .../Generated/IDisksOperations.cs | 154 +- .../Generated/IEnvironmentsOperations.cs | 98 +- .../Generated/IFormulasOperations.cs | 96 +- .../Generated/IGalleryImagesOperations.cs | 41 +- .../Generated/IGlobalSchedulesOperations.cs | 141 +- .../Generated/ILabsOperations.cs | 234 +-- .../INotificationChannelsOperations.cs | 89 +- .../Generated/IOperations.cs | 25 +- .../Generated/IPoliciesOperations.cs | 80 +- .../Generated/IPolicySetsOperations.cs | 25 +- .../Generated/IProviderOperations.cs | 34 +- .../Generated/ISchedulesOperations.cs | 115 +- .../Generated/ISecretsOperations.cs | 70 +- .../Generated/IServiceRunnersOperations.cs | 68 +- .../Generated/IUsersOperations.cs | 88 +- .../IVirtualMachineSchedulesOperations.cs | 97 +- .../Generated/IVirtualMachinesOperations.cs | 282 +-- .../Generated/IVirtualNetworksOperations.cs | 114 +- .../Generated/LabsOperations.cs | 1579 ++++++++------- .../Generated/LabsOperationsExtensions.cs | 1337 ++++++------- .../Generated/Models/ApplicableSchedule.cs | 77 +- .../Models/ApplicableScheduleFragment.cs | 77 +- .../Models/ApplicableScheduleProperties.cs | 62 + .../ApplicableSchedulePropertiesFragment.cs | 62 + .../Generated/Models/ApplyArtifactsRequest.cs | 29 +- .../Generated/Models/ArmTemplate.cs | 121 +- .../Generated/Models/ArmTemplateInfo.cs | 38 +- .../Models/ArmTemplateParameterProperties.cs | 41 +- .../Generated/Models/ArmTemplateProperties.cs | 110 ++ .../Generated/Models/Artifact.cs | 137 +- .../ArtifactDeploymentStatusProperties.cs | 58 +- ...ifactDeploymentStatusPropertiesFragment.cs | 58 +- .../Models/ArtifactInstallProperties.cs | 88 +- .../ArtifactInstallPropertiesFragment.cs | 94 +- .../Models/ArtifactParameterProperties.cs | 41 +- .../ArtifactParameterPropertiesFragment.cs | 41 +- .../Generated/Models/ArtifactProperties.cs | 118 ++ .../Generated/Models/ArtifactSource.cs | 186 +- .../Models/ArtifactSourceFragment.cs | 173 +- .../Models/ArtifactSourceProperties.cs | 149 ++ .../ArtifactSourcePropertiesFragment.cs | 139 ++ .../Generated/Models/AttachDiskProperties.cs | 32 +- .../Models/AttachNewDataDiskOptions.cs | 51 +- .../Models/BulkCreationParameters.cs | 26 +- .../Generated/Models/ComputeDataDisk.cs | 65 +- .../Models/ComputeDataDiskFragment.cs | 65 +- .../Models/ComputeVmInstanceViewStatus.cs | 59 +- .../ComputeVmInstanceViewStatusFragment.cs | 59 +- .../Generated/Models/ComputeVmProperties.cs | 109 +- .../Models/ComputeVmPropertiesFragment.cs | 115 +- .../Models/CostThresholdProperties.cs | 85 +- .../Generated/Models/CostThresholdStatus.cs | 13 +- .../Generated/Models/CostType.cs | 13 +- .../Generated/Models/CustomImage.cs | 147 +- .../Generated/Models/CustomImageOsType.cs | 13 +- .../Generated/Models/CustomImageProperties.cs | 137 ++ .../Models/CustomImagePropertiesCustom.cs | 65 +- .../Models/CustomImagePropertiesFromVm.cs | 55 +- .../Generated/Models/DataDiskProperties.cs | 62 +- .../Generated/Models/DayDetails.cs | 25 +- .../Generated/Models/DayDetailsFragment.cs | 25 +- .../Models/DetachDataDiskProperties.cs | 29 +- .../Generated/Models/DetachDiskProperties.cs | 31 +- .../Generated/Models/Disk.cs | 173 +- .../Generated/Models/DiskProperties.cs | 141 ++ .../Generated/Models/DtlEnvironment.cs | 120 +- .../Generated/Models/EnableStatus.cs | 13 +- .../Models/EnvironmentDeploymentProperties.cs | 49 +- .../Generated/Models/EnvironmentProperties.cs | 102 + .../Models/EvaluatePoliciesProperties.cs | 45 +- .../Models/EvaluatePoliciesRequest.cs | 29 +- .../Models/EvaluatePoliciesResponse.cs | 29 +- .../Generated/Models/EventFragment.cs | 33 +- .../Generated/Models/EventModel.cs | 33 +- .../Models/ExportResourceUsageParameters.cs | 56 +- .../Generated/Models/ExternalSubnet.cs | 39 +- .../Models/ExternalSubnetFragment.cs | 39 +- .../Generated/Models/FileUploadOptions.cs | 13 +- .../Generated/Models/Formula.cs | 135 +- .../Generated/Models/FormulaProperties.cs | 118 ++ .../Models/FormulaPropertiesFromVm.cs | 28 +- .../Generated/Models/GalleryImage.cs | 109 +- .../Models/GalleryImageProperties.cs | 98 + .../Generated/Models/GalleryImageReference.cs | 65 +- .../Models/GalleryImageReferenceFragment.cs | 71 +- .../Models/GenerateArmTemplateRequest.cs | 68 +- .../Models/GenerateUploadUriParameter.cs | 25 +- .../Models/GenerateUploadUriResponse.cs | 25 +- .../Generated/Models/HostCachingOptions.cs | 13 +- .../Generated/Models/HourDetails.cs | 26 +- .../Generated/Models/HourDetailsFragment.cs | 26 +- .../Generated/Models/HttpStatusCode.cs | 13 +- .../Generated/Models/IdentityProperties.cs | 57 +- .../Generated/Models/InboundNatRule.cs | 66 +- .../Models/InboundNatRuleFragment.cs | 66 +- .../Generated/Models/Lab.cs | 186 +- .../Generated/Models/LabCost.cs | 151 +- .../Models/LabCostDetailsProperties.cs | 49 +- .../Generated/Models/LabCostProperties.cs | 138 ++ .../Models/LabCostSummaryProperties.cs | 26 +- .../Generated/Models/LabFragment.cs | 112 +- .../Generated/Models/LabProperties.cs | 148 ++ .../Generated/Models/LabPropertiesFragment.cs | 88 + .../Models/LabResourceCostProperties.cs | 118 +- .../Generated/Models/LabVhd.cs | 25 +- .../Generated/Models/LabVirtualMachine.cs | 440 +++-- .../LabVirtualMachineCreationParameter.cs | 479 ++--- ...rtualMachineCreationParameterProperties.cs | 357 ++++ .../Models/LabVirtualMachineFragment.cs | 418 ++-- .../Models/LabVirtualMachineProperties.cs | 357 ++++ .../LabVirtualMachinePropertiesFragment.cs | 347 ++++ .../Generated/Models/LinuxOsInfo.cs | 35 +- .../Generated/Models/LinuxOsState.cs | 13 +- .../Models/NetworkInterfaceProperties.cs | 132 +- .../NetworkInterfacePropertiesFragment.cs | 138 +- .../Generated/Models/NotificationChannel.cs | 113 +- .../Models/NotificationChannelEventType.cs | 13 +- .../Models/NotificationChannelFragment.cs | 108 +- .../Models/NotificationChannelProperties.cs | 98 + .../NotificationChannelPropertiesFragment.cs | 88 + .../Generated/Models/NotificationSettings.cs | 60 +- .../Models/NotificationSettingsFragment.cs | 66 +- .../Generated/Models/NotificationStatus.cs | 13 +- .../Generated/Models/NotifyParameters.cs | 40 +- .../Generated/Models/OperationError.cs | 36 +- .../Generated/Models/OperationMetadata.cs | 37 +- .../Models/OperationMetadataDisplay.cs | 61 +- .../Generated/Models/OperationResult.cs | 83 +- .../Generated/Models/Page.cs | 74 +- .../Generated/Models/ParameterInfo.cs | 37 +- .../Models/ParametersValueFileInfo.cs | 35 +- .../PercentageCostThresholdProperties.cs | 31 +- .../Generated/Models/Policy.cs | 171 +- .../Generated/Models/PolicyEvaluatorType.cs | 13 +- .../Generated/Models/PolicyFactName.cs | 13 +- .../Generated/Models/PolicyFragment.cs | 161 +- .../Generated/Models/PolicyProperties.cs | 136 ++ .../Models/PolicyPropertiesFragment.cs | 126 ++ .../Generated/Models/PolicySetResult.cs | 46 +- .../Generated/Models/PolicyStatus.cs | 13 +- .../Generated/Models/PolicyViolation.cs | 35 +- .../Generated/Models/Port.cs | 40 +- .../Generated/Models/PortFragment.cs | 40 +- .../Generated/Models/PremiumDataDisk.cs | 13 +- .../Generated/Models/ReportingCycleType.cs | 13 +- .../Generated/Models/Resource.cs | 73 +- .../Models/RetargetScheduleProperties.cs | 46 +- .../Generated/Models/Schedule.cs | 191 +- .../Generated/Models/ScheduleFragment.cs | 176 +- .../Generated/Models/ScheduleProperties.cs | 155 ++ .../Models/SchedulePropertiesFragment.cs | 145 ++ .../Generated/Models/Secret.cs | 78 +- .../Generated/Models/SecretProperties.cs | 68 + .../Generated/Models/ServiceRunner.cs | 51 +- .../SharedPublicIpAddressConfiguration.cs | 35 +- ...redPublicIpAddressConfigurationFragment.cs | 35 +- .../Models/ShutdownNotificationContent.cs | 137 +- .../Generated/Models/SourceControlType.cs | 13 +- .../Generated/Models/StorageType.cs | 13 +- .../Generated/Models/Subnet.cs | 56 +- .../Generated/Models/SubnetFragment.cs | 56 +- .../Generated/Models/SubnetOverride.cs | 100 +- .../Models/SubnetOverrideFragment.cs | 100 +- ...ubnetSharedPublicIpAddressConfiguration.cs | 40 +- ...redPublicIpAddressConfigurationFragment.cs | 40 +- .../Generated/Models/TargetCostProperties.cs | 88 +- .../Generated/Models/TargetCostStatus.cs | 13 +- .../Generated/Models/TransportProtocol.cs | 13 +- .../Generated/Models/UsagePermissionType.cs | 13 +- .../Generated/Models/User.cs | 98 +- .../Generated/Models/UserFragment.cs | 87 +- .../Generated/Models/UserIdentity.cs | 96 +- .../Generated/Models/UserIdentityFragment.cs | 96 +- .../Generated/Models/UserProperties.cs | 88 + .../Models/UserPropertiesFragment.cs | 78 + .../Generated/Models/UserSecretStore.cs | 41 +- .../Models/UserSecretStoreFragment.cs | 41 +- .../Models/VirtualMachineCreationSource.cs | 13 +- .../Generated/Models/VirtualNetwork.cs | 137 +- .../Models/VirtualNetworkFragment.cs | 126 +- .../Models/VirtualNetworkProperties.cs | 119 ++ .../VirtualNetworkPropertiesFragment.cs | 109 ++ .../Generated/Models/WeekDetails.cs | 46 +- .../Generated/Models/WeekDetailsFragment.cs | 46 +- .../Generated/Models/WindowsOsInfo.cs | 35 +- .../Generated/Models/WindowsOsState.cs | 13 +- .../NotificationChannelsOperations.cs | 835 ++++---- ...otificationChannelsOperationsExtensions.cs | 541 +++--- .../Generated/Operations.cs | 135 +- .../Generated/OperationsExtensions.cs | 88 +- .../Generated/PoliciesOperations.cs | 731 +++---- .../Generated/PoliciesOperationsExtensions.cs | 524 +++-- .../Generated/PolicySetsOperations.cs | 155 +- .../PolicySetsOperationsExtensions.cs | 94 +- .../Generated/ProviderOperations.cs | 203 +- .../Generated/ProviderOperationsExtensions.cs | 125 +- .../Generated/SchedulesOperations.cs | 1027 +++++----- .../SchedulesOperationsExtensions.cs | 740 ++++---- .../Generated/SdkInfo_DevTestLabsClient.cs | 49 - .../Generated/SecretsOperations.cs | 602 +++--- .../Generated/SecretsOperationsExtensions.cs | 433 ++--- .../Generated/ServiceRunnersOperations.cs | 587 +++--- .../ServiceRunnersOperationsExtensions.cs | 373 ++-- .../Generated/UsersOperations.cs | 726 +++---- .../Generated/UsersOperationsExtensions.cs | 535 +++--- .../VirtualMachineSchedulesOperations.cs | 850 +++++---- ...ualMachineSchedulesOperationsExtensions.cs | 690 ++++--- .../Generated/VirtualMachinesOperations.cs | 1585 +++++++++------- .../VirtualMachinesOperationsExtensions.cs | 1689 ++++++++--------- .../Generated/VirtualNetworksOperations.cs | 736 +++---- .../VirtualNetworksOperationsExtensions.cs | 622 +++--- .../DevTestLabs.Management.Sdk/README.md | 6 +- src/DevTestLabs/DevTestLabs.sln | 1 - 240 files changed, 24749 insertions(+), 19824 deletions(-) create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedulePropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourcePropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachinePropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SchedulePropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserPropertiesFragment.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkProperties.cs create mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkPropertiesFragment.cs delete mode 100644 src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs index 2c6ee783ea9d..62e80ed87c18 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// ArmTemplatesOperations operations. /// - internal partial class ArmTemplatesOperations : IServiceOperations, IArmTemplatesOperations + internal partial class ArmTemplatesOperations : Microsoft.Rest.IServiceOperations, IArmTemplatesOperations { /// /// Initializes a new instance of the ArmTemplatesOperations class. @@ -37,13 +24,13 @@ internal partial class ArmTemplatesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ArmTemplatesOperations(DevTestLabsClient client) + internal ArmTemplatesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,28 +41,28 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// List azure resource manager templates in a given artifact source. /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the artifact source. /// - /// - /// 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 /// /// @@ -84,85 +71,98 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (artifactSourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _armTemplate = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_armTemplate)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_armTemplate); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -174,55 +174,56 @@ internal ArmTemplatesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -232,9 +233,10 @@ internal ArmTemplatesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -245,25 +247,29 @@ internal ArmTemplatesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get azure resource manager template. /// @@ -277,7 +283,7 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// The name of the azure Resource Manager template. /// /// - /// Specify the $expand query. Example: 'properties($select=displayName)' + /// Specify the $expand query. Example: 'properties($select=displayName)' /// /// /// Headers that will be added to request. @@ -285,13 +291,13 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -300,87 +306,101 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (artifactSourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -392,55 +412,56 @@ internal ArmTemplatesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -450,9 +471,10 @@ internal ArmTemplatesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -463,25 +485,29 @@ internal ArmTemplatesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List azure resource manager templates in a given artifact source. /// @@ -494,13 +520,13 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -509,51 +535,54 @@ internal ArmTemplatesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -565,55 +594,56 @@ internal ArmTemplatesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -623,9 +653,10 @@ internal ArmTemplatesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -636,24 +667,28 @@ internal ArmTemplatesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs index bd53c1415237..60f209d3956a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs @@ -1,158 +1,145 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for ArmTemplatesOperations. + /// Extension methods for ArmTemplatesOperations /// public static partial class ArmTemplatesOperationsExtensions { - /// - /// List azure resource manager templates in a given artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IArmTemplatesOperations operations, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List azure resource manager templates in a given artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IArmTemplatesOperations operations, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static Microsoft.Rest.Azure.IPage List(this IArmTemplatesOperations operations, string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IArmTemplatesOperations)operations).ListAsync(labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get azure resource manager template. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// The name of the azure Resource Manager template. - /// - /// - /// Specify the $expand query. Example: 'properties($select=displayName)' - /// - public static ArmTemplate Get(this IArmTemplatesOperations operations, string labName, string artifactSourceName, string name, string expand = default(string)) + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IArmTemplatesOperations operations, string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Get azure resource manager template. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + public static ArmTemplate Get(this IArmTemplatesOperations operations, string labName, string artifactSourceName, string name, string expand = default(string)) + { + return ((IArmTemplatesOperations)operations).GetAsync(labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Get azure resource manager template. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// The name of the azure Resource Manager template. - /// - /// - /// Specify the $expand query. Example: 'properties($select=displayName)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IArmTemplatesOperations operations, string labName, string artifactSourceName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get azure resource manager template. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IArmTemplatesOperations operations, string labName, string artifactSourceName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IArmTemplatesOperations operations, string nextPageLink) + { + return ((IArmTemplatesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// List azure resource manager templates in a given artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IArmTemplatesOperations operations, string nextPageLink) + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IArmTemplatesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// List azure resource manager templates in a given artifact source. - /// - /// - /// 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 IArmTemplatesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs index af90c5cb9973..c73819554573 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// ArtifactSourcesOperations operations. /// - internal partial class ArtifactSourcesOperations : IServiceOperations, IArtifactSourcesOperations + internal partial class ArtifactSourcesOperations : Microsoft.Rest.IServiceOperations, IArtifactSourcesOperations { /// /// Initializes a new instance of the ArtifactSourcesOperations class. @@ -37,13 +24,13 @@ internal partial class ArtifactSourcesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ArtifactSourcesOperations(DevTestLabsClient client) + internal ArtifactSourcesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// List artifact sources in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _artifactSource = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_artifactSource)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_artifactSource); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get artifact source. /// @@ -265,7 +270,7 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// The name of the artifact source. /// /// - /// Specify the $expand query. Example: 'properties($select=displayName)' + /// Specify the $expand query. Example: 'properties($select=displayName)' /// /// /// Headers that will be added to request. @@ -273,13 +278,13 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -288,81 +293,94 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -374,55 +392,56 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -432,9 +451,10 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -445,25 +465,29 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing artifact source. /// @@ -482,13 +506,13 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -497,81 +521,94 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ArtifactSource artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ArtifactSource artifactSource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (artifactSource == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSource"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (artifactSource == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "artifactSource"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("artifactSource", artifactSource); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -583,61 +620,62 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(artifactSource != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(artifactSource, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(artifactSource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -647,9 +685,10 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -660,16 +699,16 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -678,25 +717,29 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete artifact source. /// @@ -712,10 +755,10 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -724,76 +767,88 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -805,55 +860,56 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -863,20 +919,25 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Modify properties of artifact sources. /// @@ -895,13 +956,13 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -910,81 +971,93 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string labName, string name, ArtifactSourceFragment artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, ArtifactSourceFragment artifactSource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (artifactSource == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSource"); } - if (Client.ResourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (artifactSource == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "artifactSource"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("artifactSource", artifactSource); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -996,61 +1069,62 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(artifactSource != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(artifactSource, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(artifactSource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1060,9 +1134,10 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1073,25 +1148,29 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List artifact sources in a given lab. /// @@ -1104,13 +1183,13 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1119,51 +1198,54 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1175,55 +1257,56 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1233,9 +1316,10 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1246,24 +1330,28 @@ internal ArtifactSourcesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs index b8ca51615f84..dbdb07eb7027 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs @@ -1,275 +1,247 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for ArtifactSourcesOperations. + /// Extension methods for ArtifactSourcesOperations /// public static partial class ArtifactSourcesOperationsExtensions { - /// - /// List artifact sources in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IArtifactSourcesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List artifact sources in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IArtifactSourcesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IArtifactSourcesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IArtifactSourcesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// Specify the $expand query. Example: 'properties($select=displayName)' - /// - public static ArtifactSource Get(this IArtifactSourcesOperations operations, string labName, string name, string expand = default(string)) + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IArtifactSourcesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Get artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + public static ArtifactSource Get(this IArtifactSourcesOperations operations, string labName, string name, string expand = default(string)) + { + return ((IArtifactSourcesOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Get artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// Specify the $expand query. Example: 'properties($select=displayName)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IArtifactSourcesOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IArtifactSourcesOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Create or replace an existing artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSource artifactSource) + { + return ((IArtifactSourcesOperations)operations).CreateOrUpdateAsync(labName, name, artifactSource).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// Properties of an artifact source. - /// - public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSource artifactSource) + /// + /// Create or replace an existing artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSource artifactSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(labName, name, artifactSource).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Delete artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static void Delete(this IArtifactSourcesOperations operations, string labName, string name) + { + ((IArtifactSourcesOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// Properties of an artifact source. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSource artifactSource, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - public static void Delete(this IArtifactSourcesOperations operations, string labName, string name) - { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); - } + /// + /// Delete artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IArtifactSourcesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of artifact sources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static ArtifactSource Update(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSourceFragment artifactSource) + { + return ((IArtifactSourcesOperations)operations).UpdateAsync(labName, name, artifactSource).GetAwaiter().GetResult(); + } - /// - /// Delete artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IArtifactSourcesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Modify properties of artifact sources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSourceFragment artifactSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IArtifactSourcesOperations operations, string nextPageLink) + { + return ((IArtifactSourcesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Modify properties of artifact sources. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// Properties of an artifact source. - /// - public static ArtifactSource Update(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSourceFragment artifactSource) + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IArtifactSourcesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(labName, name, artifactSource).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Modify properties of artifact sources. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// Properties of an artifact source. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSourceFragment artifactSource, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List artifact sources in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IArtifactSourcesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List artifact sources in a given lab. - /// - /// - /// 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 IArtifactSourcesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs index 8ff9a806f6c5..917843baaf73 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// ArtifactsOperations operations. /// - internal partial class ArtifactsOperations : IServiceOperations, IArtifactsOperations + internal partial class ArtifactsOperations : Microsoft.Rest.IServiceOperations, IArtifactsOperations { /// /// Initializes a new instance of the ArtifactsOperations class. @@ -37,13 +24,13 @@ internal partial class ArtifactsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ArtifactsOperations(DevTestLabsClient client) + internal ArtifactsOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,28 +41,28 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// List artifacts in a given artifact source. /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the artifact source. /// - /// - /// 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 /// /// @@ -84,85 +71,98 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (artifactSourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _artifact = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_artifact)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_artifact); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -174,55 +174,56 @@ internal ArtifactsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -232,9 +233,10 @@ internal ArtifactsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -245,25 +247,29 @@ internal ArtifactsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get artifact. /// @@ -277,7 +283,7 @@ internal ArtifactsOperations(DevTestLabsClient client) /// The name of the artifact. /// /// - /// Specify the $expand query. Example: 'properties($select=title)' + /// Specify the $expand query. Example: 'properties($select=title)' /// /// /// Headers that will be added to request. @@ -285,13 +291,13 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -300,87 +306,101 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (artifactSourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -392,55 +412,56 @@ internal ArtifactsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -450,9 +471,10 @@ internal ArtifactsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -463,25 +485,29 @@ internal ArtifactsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Generates an ARM template for the given artifact, uploads the required /// files to a storage account, and validates the generated artifact. @@ -504,13 +530,13 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -519,87 +545,101 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GenerateArmTemplateWithHttpMessagesAsync(string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GenerateArmTemplateWithHttpMessagesAsync(string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (generateArmTemplateRequest == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "generateArmTemplateRequest"); + } + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (artifactSourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "artifactSourceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (generateArmTemplateRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "generateArmTemplateRequest"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("artifactSourceName", artifactSourceName); tracingParameters.Add("name", name); + tracingParameters.Add("generateArmTemplateRequest", generateArmTemplateRequest); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GenerateArmTemplate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GenerateArmTemplate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -611,61 +651,62 @@ internal ArtifactsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(generateArmTemplateRequest != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(generateArmTemplateRequest, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(generateArmTemplateRequest, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -675,9 +716,10 @@ internal ArtifactsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -688,25 +730,29 @@ internal ArtifactsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List artifacts in a given artifact source. /// @@ -719,13 +765,13 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -734,51 +780,54 @@ internal ArtifactsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -790,55 +839,56 @@ internal ArtifactsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -848,9 +898,10 @@ internal ArtifactsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -861,24 +912,28 @@ internal ArtifactsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs index 4f66a52b6113..f20f0c577fae 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs @@ -1,212 +1,192 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for ArtifactsOperations. + /// Extension methods for ArtifactsOperations /// public static partial class ArtifactsOperationsExtensions { - /// - /// List artifacts in a given artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IArtifactsOperations operations, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); - } + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static Microsoft.Rest.Azure.IPage List(this IArtifactsOperations operations, string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IArtifactsOperations)operations).ListAsync(labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// List artifacts in a given artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + public static Artifact Get(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, string expand = default(string)) + { + return ((IArtifactsOperations)operations).GetAsync(labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Get artifact. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// The name of the artifact. - /// - /// - /// Specify the $expand query. Example: 'properties($select=title)' - /// - public static Artifact Get(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, string expand = default(string)) + /// + /// Get artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + public static ArmTemplateInfo GenerateArmTemplate(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest) + { + return ((IArtifactsOperations)operations).GenerateArmTemplateAsync(labName, artifactSourceName, name, generateArmTemplateRequest).GetAwaiter().GetResult(); + } - /// - /// Get artifact. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// The name of the artifact. - /// - /// - /// Specify the $expand query. Example: 'properties($select=title)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GenerateArmTemplateAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GenerateArmTemplateWithHttpMessagesAsync(labName, artifactSourceName, name, generateArmTemplateRequest, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IArtifactsOperations operations, string nextPageLink) + { + return ((IArtifactsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Generates an ARM template for the given artifact, uploads the required - /// files to a storage account, and validates the generated artifact. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// The name of the artifact. - /// - /// - /// Parameters for generating an ARM template for deploying artifacts. - /// - public static ArmTemplateInfo GenerateArmTemplate(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest) + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IArtifactsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.GenerateArmTemplateAsync(labName, artifactSourceName, name, generateArmTemplateRequest).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Generates an ARM template for the given artifact, uploads the required - /// files to a storage account, and validates the generated artifact. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the artifact source. - /// - /// - /// The name of the artifact. - /// - /// - /// Parameters for generating an ARM template for deploying artifacts. - /// - /// - /// The cancellation token. - /// - public static async Task GenerateArmTemplateAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GenerateArmTemplateWithHttpMessagesAsync(labName, artifactSourceName, name, generateArmTemplateRequest, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List artifacts in a given artifact source. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IArtifactsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List artifacts in a given artifact source. - /// - /// - /// 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 IArtifactsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs index 11e3ff7bbbf4..be53e319f202 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// CostsOperations operations. /// - internal partial class CostsOperations : IServiceOperations, ICostsOperations + internal partial class CostsOperations : Microsoft.Rest.IServiceOperations, ICostsOperations { /// /// Initializes a new instance of the CostsOperations class. @@ -36,13 +24,13 @@ internal partial class CostsOperations : IServiceOperations, /// /// Thrown when a required parameter is null /// - internal CostsOperations(DevTestLabsClient client) + internal CostsOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -60,7 +48,7 @@ internal CostsOperations(DevTestLabsClient client) /// The name of the cost. /// /// - /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' /// /// /// Headers that will be added to request. @@ -68,13 +56,13 @@ internal CostsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -83,81 +71,94 @@ internal CostsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -169,55 +170,56 @@ internal CostsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -227,9 +229,10 @@ internal CostsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -240,25 +243,29 @@ internal CostsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing cost. /// @@ -277,13 +284,13 @@ internal CostsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -292,81 +299,94 @@ internal CostsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabCost labCost, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabCost labCost, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (labCost == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labCost"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (labCost == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labCost"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("labCost", labCost); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -378,61 +398,62 @@ internal CostsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(labCost != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labCost, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(labCost, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -442,9 +463,10 @@ internal CostsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -455,16 +477,16 @@ internal CostsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -473,24 +495,28 @@ internal CostsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs index 080159be0bae..2f72402025ab 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs @@ -1,117 +1,100 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for CostsOperations. + /// Extension methods for CostsOperations /// public static partial class CostsOperationsExtensions { - /// - /// Get cost. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the cost. - /// - /// - /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' - /// - public static LabCost Get(this ICostsOperations operations, string labName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); - } + /// + /// Get cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + public static LabCost Get(this ICostsOperations operations, string labName, string name, string expand = default(string)) + { + return ((ICostsOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Get cost. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the cost. - /// - /// - /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ICostsOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ICostsOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Create or replace an existing cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + public static LabCost CreateOrUpdate(this ICostsOperations operations, string labName, string name, LabCost labCost) + { + return ((ICostsOperations)operations).CreateOrUpdateAsync(labName, name, labCost).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing cost. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the cost. - /// - /// - /// A cost item. - /// - public static LabCost CreateOrUpdate(this ICostsOperations operations, string labName, string name, LabCost labCost) + /// + /// Create or replace an existing cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ICostsOperations operations, string labName, string name, LabCost labCost, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, labCost, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(labName, name, labCost).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Create or replace an existing cost. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the cost. - /// - /// - /// A cost item. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ICostsOperations operations, string labName, string name, LabCost labCost, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, labCost, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs index 7ffc23ae1faa..7dd972eb8d56 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// CustomImagesOperations operations. /// - internal partial class CustomImagesOperations : IServiceOperations, ICustomImagesOperations + internal partial class CustomImagesOperations : Microsoft.Rest.IServiceOperations, ICustomImagesOperations { /// /// Initializes a new instance of the CustomImagesOperations class. @@ -37,13 +24,13 @@ internal partial class CustomImagesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal CustomImagesOperations(DevTestLabsClient client) + internal CustomImagesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// List custom images in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _customImage = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_customImage)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_customImage); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal CustomImagesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal CustomImagesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal CustomImagesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get custom image. /// @@ -265,7 +270,7 @@ internal CustomImagesOperations(DevTestLabsClient client) /// The name of the custom image. /// /// - /// Specify the $expand query. Example: 'properties($select=vm)' + /// Specify the $expand query. Example: 'properties($select=vm)' /// /// /// Headers that will be added to request. @@ -273,13 +278,13 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -288,81 +293,94 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -374,55 +392,56 @@ internal CustomImagesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -432,9 +451,10 @@ internal CustomImagesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -445,25 +465,29 @@ internal CustomImagesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing custom image. This operation can take a while /// to complete. @@ -478,16 +502,16 @@ internal CustomImagesOperations(DevTestLabsClient client) /// A custom image. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -500,16 +524,16 @@ internal CustomImagesOperations(DevTestLabsClient client) /// The name of the custom image. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -531,13 +555,13 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -546,85 +570,97 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (customImage == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customImage"); } - if (Client.ResourceGroupName == null) + if (customImage != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + customImage.Validate(); } - if (labName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (customImage == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "customImage"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (customImage != null) + + if (name == null) { - customImage.Validate(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("customImage", customImage); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -636,61 +672,62 @@ internal CustomImagesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(customImage != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(customImage, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(customImage, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -700,9 +737,10 @@ internal CustomImagesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -713,16 +751,16 @@ internal CustomImagesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -731,25 +769,29 @@ internal CustomImagesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete custom image. This operation can take a while to complete. /// @@ -765,10 +807,10 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -777,76 +819,88 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -858,55 +912,56 @@ internal CustomImagesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -916,20 +971,25 @@ internal CustomImagesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List custom images in a given lab. /// @@ -942,13 +1002,13 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -957,51 +1017,54 @@ internal CustomImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1013,55 +1076,56 @@ internal CustomImagesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1071,9 +1135,10 @@ internal CustomImagesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1084,24 +1149,28 @@ internal CustomImagesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs index 67bb34be3d47..191912f05c85 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs @@ -1,316 +1,287 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for CustomImagesOperations. + /// Extension methods for CustomImagesOperations /// public static partial class CustomImagesOperationsExtensions { - /// - /// List custom images in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this ICustomImagesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List custom images in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ICustomImagesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get custom image. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// Specify the $expand query. Example: 'properties($select=vm)' - /// - public static CustomImage Get(this ICustomImagesOperations operations, string labName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get custom image. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// Specify the $expand query. Example: 'properties($select=vm)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ICustomImagesOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing custom image. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// A custom image. - /// - public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage) - { - return operations.CreateOrUpdateAsync(labName, name, customImage).GetAwaiter().GetResult(); - } + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this ICustomImagesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ICustomImagesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing custom image. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// A custom image. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ICustomImagesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get custom image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + public static CustomImage Get(this ICustomImagesOperations operations, string labName, string name, string expand = default(string)) + { + return ((ICustomImagesOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Delete custom image. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - public static void Delete(this ICustomImagesOperations operations, string labName, string name) + /// + /// Get custom image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ICustomImagesOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage) + { + return ((ICustomImagesOperations)operations).CreateOrUpdateAsync(labName, name, customImage).GetAwaiter().GetResult(); + } - /// - /// Delete custom image. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ICustomImagesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static void Delete(this ICustomImagesOperations operations, string labName, string name) + { + ((ICustomImagesOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing custom image. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// A custom image. - /// - public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage) - { - return operations.BeginCreateOrUpdateAsync(labName, name, customImage).GetAwaiter().GetResult(); - } + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ICustomImagesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage) + { + return ((ICustomImagesOperations)operations).BeginCreateOrUpdateAsync(labName, name, customImage).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing custom image. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// A custom image. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static void BeginDelete(this ICustomImagesOperations operations, string labName, string name) + { + ((ICustomImagesOperations)operations).BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Delete custom image. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - public static void BeginDelete(this ICustomImagesOperations operations, string labName, string name) - { - operations.BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); - } + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this ICustomImagesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this ICustomImagesOperations operations, string nextPageLink) + { + return ((ICustomImagesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Delete custom image. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the custom image. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this ICustomImagesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this ICustomImagesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// List custom images in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ICustomImagesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List custom images in a given lab. - /// - /// - /// 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 ICustomImagesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs index 89e5e662c07f..85a2515694f5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs @@ -1,199 +1,162 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// The DevTest Labs Client. /// - public partial class DevTestLabsClient : ServiceClient, IDevTestLabsClient, IAzureClient + public partial class DevTestLabsClient : Microsoft.Rest.ServiceClient, IDevTestLabsClient, 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; } - + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// - public JsonSerializerSettings DeserializationSettings { get; private set; } - + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Credentials needed for the client to connect to Azure. /// - public ServiceClientCredentials Credentials { get; private set; } + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } /// - /// Client API version. + /// The API version to use for this operation. /// public string ApiVersion { get; private set; } /// /// The name of the resource group. /// - public string ResourceGroupName { get; set; } + public string ResourceGroupName { get; set;} /// /// The subscription ID. /// - public string SubscriptionId { get; set; } + public string SubscriptionId { get; set;} /// /// The preferred language for the response. /// - public string AcceptLanguage { get; set; } + public string AcceptLanguage { get; set;} /// - /// The retry timeout in seconds for Long Running Operations. Default value is - /// 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. /// - public int? LongRunningOperationRetryTimeout { get; set; } + 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. + /// 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; } + public bool? GenerateClientRequestId { get; set;} /// - /// Gets the IProviderOperations. + /// Gets the IProviderOperations /// public virtual IProviderOperations ProviderOperations { get; private set; } - /// - /// Gets the ILabsOperations. + /// Gets the ILabsOperations /// public virtual ILabsOperations Labs { get; private set; } - /// - /// Gets the IOperations. + /// Gets the IOperations /// public virtual IOperations Operations { get; private set; } - /// - /// Gets the IGlobalSchedulesOperations. + /// Gets the IGlobalSchedulesOperations /// public virtual IGlobalSchedulesOperations GlobalSchedules { get; private set; } - /// - /// Gets the IArtifactSourcesOperations. + /// Gets the IArtifactSourcesOperations /// public virtual IArtifactSourcesOperations ArtifactSources { get; private set; } - /// - /// Gets the IArmTemplatesOperations. + /// Gets the IArmTemplatesOperations /// public virtual IArmTemplatesOperations ArmTemplates { get; private set; } - /// - /// Gets the IArtifactsOperations. + /// Gets the IArtifactsOperations /// public virtual IArtifactsOperations Artifacts { get; private set; } - /// - /// Gets the ICostsOperations. + /// Gets the ICostsOperations /// public virtual ICostsOperations Costs { get; private set; } - /// - /// Gets the ICustomImagesOperations. + /// Gets the ICustomImagesOperations /// public virtual ICustomImagesOperations CustomImages { get; private set; } - /// - /// Gets the IFormulasOperations. + /// Gets the IFormulasOperations /// public virtual IFormulasOperations Formulas { get; private set; } - /// - /// Gets the IGalleryImagesOperations. + /// Gets the IGalleryImagesOperations /// public virtual IGalleryImagesOperations GalleryImages { get; private set; } - /// - /// Gets the INotificationChannelsOperations. + /// Gets the INotificationChannelsOperations /// public virtual INotificationChannelsOperations NotificationChannels { get; private set; } - /// - /// Gets the IPolicySetsOperations. + /// Gets the IPolicySetsOperations /// public virtual IPolicySetsOperations PolicySets { get; private set; } - /// - /// Gets the IPoliciesOperations. + /// Gets the IPoliciesOperations /// public virtual IPoliciesOperations Policies { get; private set; } - /// - /// Gets the ISchedulesOperations. + /// Gets the ISchedulesOperations /// public virtual ISchedulesOperations Schedules { get; private set; } - /// - /// Gets the IServiceRunnersOperations. + /// Gets the IServiceRunnersOperations /// public virtual IServiceRunnersOperations ServiceRunners { get; private set; } - /// - /// Gets the IUsersOperations. + /// Gets the IUsersOperations /// public virtual IUsersOperations Users { get; private set; } - /// - /// Gets the IDisksOperations. + /// Gets the IDisksOperations /// public virtual IDisksOperations Disks { get; private set; } - /// - /// Gets the IEnvironmentsOperations. + /// Gets the IEnvironmentsOperations /// public virtual IEnvironmentsOperations Environments { get; private set; } - /// - /// Gets the ISecretsOperations. + /// Gets the ISecretsOperations /// public virtual ISecretsOperations Secrets { get; private set; } - /// - /// Gets the IVirtualMachinesOperations. + /// Gets the IVirtualMachinesOperations /// public virtual IVirtualMachinesOperations VirtualMachines { get; private set; } - /// - /// Gets the IVirtualMachineSchedulesOperations. + /// Gets the IVirtualMachineSchedulesOperations /// public virtual IVirtualMachineSchedulesOperations VirtualMachineSchedules { get; private set; } - /// - /// Gets the IVirtualNetworksOperations. + /// Gets the IVirtualNetworksOperations /// public virtual IVirtualNetworksOperations VirtualNetworks { get; private set; } - /// /// Initializes a new instance of the DevTestLabsClient class. /// @@ -202,24 +165,22 @@ public partial class DevTestLabsClient : ServiceClient, IDevT /// /// /// True: will dispose the provided httpClient on calling DevTestLabsClient.Dispose(). False: will not dispose provided httpClient - protected DevTestLabsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + protected DevTestLabsClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { - Initialize(); + this.Initialize(); } - /// /// Initializes a new instance of the DevTestLabsClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected DevTestLabsClient(params DelegatingHandler[] handlers) : base(handlers) + protected DevTestLabsClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) { - Initialize(); + this.Initialize(); } - /// - /// Initializes a new instance of the DevTestLabsClient class. + /// Initializes a new instance of the DevTestLabsClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -227,11 +188,10 @@ protected DevTestLabsClient(params DelegatingHandler[] handlers) : base(handlers /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected DevTestLabsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected DevTestLabsClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) { - Initialize(); + this.Initialize(); } - /// /// Initializes a new instance of the DevTestLabsClient class. /// @@ -244,15 +204,14 @@ protected DevTestLabsClient(HttpClientHandler rootHandler, params DelegatingHand /// /// Thrown when a required parameter is null /// - protected DevTestLabsClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected DevTestLabsClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - BaseUri = baseUri; + this.BaseUri = baseUri; } - /// /// Initializes a new instance of the DevTestLabsClient class. /// @@ -268,15 +227,15 @@ protected DevTestLabsClient(System.Uri baseUri, params DelegatingHandler[] handl /// /// Thrown when a required parameter is null /// - protected DevTestLabsClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected DevTestLabsClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - BaseUri = baseUri; + + this.BaseUri = baseUri; } - /// /// Initializes a new instance of the DevTestLabsClient class. /// @@ -289,23 +248,23 @@ protected DevTestLabsClient(System.Uri baseUri, HttpClientHandler rootHandler, p /// /// Thrown when a required parameter is null /// - public DevTestLabsClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public DevTestLabsClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the DevTestLabsClient class. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -316,23 +275,23 @@ public DevTestLabsClient(ServiceClientCredentials credentials, params Delegating /// /// Thrown when a required parameter is null /// - public DevTestLabsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + public DevTestLabsClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the DevTestLabsClient class. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -344,26 +303,26 @@ public DevTestLabsClient(ServiceClientCredentials credentials, HttpClient httpCl /// /// Thrown when a required parameter is null /// - public DevTestLabsClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public DevTestLabsClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the DevTestLabsClient class. /// /// /// Optional. The base URI of the service. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -372,7 +331,7 @@ public DevTestLabsClient(ServiceClientCredentials credentials, HttpClientHandler /// /// Thrown when a required parameter is null /// - public DevTestLabsClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public DevTestLabsClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -382,33 +341,30 @@ public DevTestLabsClient(System.Uri baseUri, ServiceClientCredentials credential { throw new System.ArgumentNullException("credentials"); } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the DevTestLabsClient 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 DevTestLabsClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public DevTestLabsClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -418,80 +374,81 @@ public DevTestLabsClient(System.Uri baseUri, ServiceClientCredentials credential { throw new System.ArgumentNullException("credentials"); } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); + /// /// Initializes client properties. /// private void Initialize() { - ProviderOperations = new ProviderOperations(this); - Labs = new LabsOperations(this); - Operations = new Operations(this); - GlobalSchedules = new GlobalSchedulesOperations(this); - ArtifactSources = new ArtifactSourcesOperations(this); - ArmTemplates = new ArmTemplatesOperations(this); - Artifacts = new ArtifactsOperations(this); - Costs = new CostsOperations(this); - CustomImages = new CustomImagesOperations(this); - Formulas = new FormulasOperations(this); - GalleryImages = new GalleryImagesOperations(this); - NotificationChannels = new NotificationChannelsOperations(this); - PolicySets = new PolicySetsOperations(this); - Policies = new PoliciesOperations(this); - Schedules = new SchedulesOperations(this); - ServiceRunners = new ServiceRunnersOperations(this); - Users = new UsersOperations(this); - Disks = new DisksOperations(this); - Environments = new EnvironmentsOperations(this); - Secrets = new SecretsOperations(this); - VirtualMachines = new VirtualMachinesOperations(this); - VirtualMachineSchedules = new VirtualMachineSchedulesOperations(this); - VirtualNetworks = new VirtualNetworksOperations(this); - BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2016-05-15"; - AcceptLanguage = "en-US"; - LongRunningOperationRetryTimeout = 30; - GenerateClientRequestId = true; - SerializationSettings = new JsonSerializerSettings + this.ProviderOperations = new ProviderOperations(this); + this.Labs = new LabsOperations(this); + this.Operations = new Operations(this); + this.GlobalSchedules = new GlobalSchedulesOperations(this); + this.ArtifactSources = new ArtifactSourcesOperations(this); + this.ArmTemplates = new ArmTemplatesOperations(this); + this.Artifacts = new ArtifactsOperations(this); + this.Costs = new CostsOperations(this); + this.CustomImages = new CustomImagesOperations(this); + this.Formulas = new FormulasOperations(this); + this.GalleryImages = new GalleryImagesOperations(this); + this.NotificationChannels = new NotificationChannelsOperations(this); + this.PolicySets = new PolicySetsOperations(this); + this.Policies = new PoliciesOperations(this); + this.Schedules = new SchedulesOperations(this); + this.ServiceRunners = new ServiceRunnersOperations(this); + this.Users = new UsersOperations(this); + this.Disks = new DisksOperations(this); + this.Environments = new EnvironmentsOperations(this); + this.Secrets = new SecretsOperations(this); + this.VirtualMachines = new VirtualMachinesOperations(this); + this.VirtualMachineSchedules = new VirtualMachineSchedulesOperations(this); + this.VirtualNetworks = new VirtualNetworksOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.ApiVersion = "2016-05-15"; + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.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 + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List { - new Iso8601TimeSpanConverter() + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new TransformationJsonConverter()); - DeserializationSettings = new JsonSerializerSettings + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings = new Newtonsoft.Json.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 + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List { - new Iso8601TimeSpanConverter() + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() } }; CustomInitialize(); - DeserializationSettings.Converters.Add(new TransformationJsonConverter()); - DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs index 77c93b98bc40..e5d7ac49a4a0 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// DisksOperations operations. /// - internal partial class DisksOperations : IServiceOperations, IDisksOperations + internal partial class DisksOperations : Microsoft.Rest.IServiceOperations, IDisksOperations { /// /// Initializes a new instance of the DisksOperations class. @@ -37,13 +24,13 @@ internal partial class DisksOperations : IServiceOperations, /// /// Thrown when a required parameter is null /// - internal DisksOperations(DevTestLabsClient client) + internal DisksOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,28 +41,28 @@ internal DisksOperations(DevTestLabsClient client) /// /// List disks in a given user profile. /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the user profile. /// - /// - /// 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 /// /// @@ -84,85 +71,98 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _disk = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_disk)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_disk); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -174,55 +174,56 @@ internal DisksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -232,9 +233,10 @@ internal DisksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -245,25 +247,29 @@ internal DisksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get disk. /// @@ -277,7 +283,7 @@ internal DisksOperations(DevTestLabsClient client) /// The name of the disk. /// /// - /// Specify the $expand query. Example: 'properties($select=diskType)' + /// Specify the $expand query. Example: 'properties($select=diskType)' /// /// /// Headers that will be added to request. @@ -285,13 +291,13 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -300,87 +306,101 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -392,55 +412,56 @@ internal DisksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -450,9 +471,10 @@ internal DisksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -463,25 +485,29 @@ internal DisksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing disk. This operation can take a while to /// complete. @@ -499,16 +525,16 @@ internal DisksOperations(DevTestLabsClient client) /// A Disk. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -524,16 +550,16 @@ internal DisksOperations(DevTestLabsClient client) /// The name of the disk. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -553,16 +579,16 @@ internal DisksOperations(DevTestLabsClient client) /// Properties of the disk to attach. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task AttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task AttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginAttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginAttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -582,16 +608,16 @@ internal DisksOperations(DevTestLabsClient client) /// Properties of the disk to detach. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -616,13 +642,13 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -631,87 +657,101 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (disk == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "disk"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (disk == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "disk"); - } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); + tracingParameters.Add("disk", disk); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -723,61 +763,62 @@ internal DisksOperations(DevTestLabsClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(disk, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -787,9 +828,10 @@ internal DisksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -800,16 +842,16 @@ internal DisksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -818,25 +860,29 @@ internal DisksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete disk. This operation can take a while to complete. /// @@ -855,10 +901,10 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -867,82 +913,95 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -954,55 +1013,56 @@ internal DisksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1012,20 +1072,25 @@ internal DisksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Attach and create the lease of the disk to the virtual machine. This /// operation can take a while to complete. @@ -1048,10 +1113,10 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1060,87 +1125,101 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginAttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginAttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (attachDiskProperties == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "attachDiskProperties"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (attachDiskProperties == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "attachDiskProperties"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); + tracingParameters.Add("attachDiskProperties", attachDiskProperties); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginAttach", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginAttach", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1152,61 +1231,62 @@ internal DisksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(attachDiskProperties != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(attachDiskProperties, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(attachDiskProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1216,20 +1296,25 @@ internal DisksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Detach and break the lease of the disk attached to the virtual machine. /// This operation can take a while to complete. @@ -1252,10 +1337,10 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1264,87 +1349,101 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (detachDiskProperties == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "detachDiskProperties"); + } + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (detachDiskProperties == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "detachDiskProperties"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); + tracingParameters.Add("detachDiskProperties", detachDiskProperties); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDetach", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDetach", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1356,61 +1455,62 @@ internal DisksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(detachDiskProperties != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(detachDiskProperties, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(detachDiskProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1420,20 +1520,25 @@ internal DisksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List disks in a given user profile. /// @@ -1446,13 +1551,13 @@ internal DisksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1461,51 +1566,54 @@ internal DisksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1517,55 +1625,56 @@ internal DisksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1575,9 +1684,10 @@ internal DisksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1588,24 +1698,28 @@ internal DisksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs index 84553486368a..5e53fc8e1d97 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs @@ -1,556 +1,499 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for DisksOperations. + /// Extension methods for DisksOperations /// public static partial class DisksOperationsExtensions { - /// - /// List disks in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IDisksOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List disks in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IDisksOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get disk. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Specify the $expand query. Example: 'properties($select=diskType)' - /// - public static Disk Get(this IDisksOperations operations, string labName, string userName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get disk. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Specify the $expand query. Example: 'properties($select=diskType)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDisksOperations operations, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing disk. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// A Disk. - /// - public static Disk CreateOrUpdate(this IDisksOperations operations, string labName, string userName, string name, Disk disk) - { - return operations.CreateOrUpdateAsync(labName, userName, name, disk).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing disk. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// A Disk. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IDisksOperations operations, string labName, string userName, string name, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete disk. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - public static void Delete(this IDisksOperations operations, string labName, string userName, string name) - { - operations.DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete disk. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDisksOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static Microsoft.Rest.Azure.IPage List(this IDisksOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IDisksOperations)operations).ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Attach and create the lease of the disk to the virtual machine. This - /// operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Properties of the disk to attach. - /// - public static void Attach(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IDisksOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - operations.AttachAsync(labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Get disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + public static Disk Get(this IDisksOperations operations, string labName, string userName, string name, string expand = default(string)) + { + return ((IDisksOperations)operations).GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Attach and create the lease of the disk to the virtual machine. This - /// operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Properties of the disk to attach. - /// - /// - /// The cancellation token. - /// - public static async Task AttachAsync(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IDisksOperations operations, string labName, string userName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - (await operations.AttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static Disk CreateOrUpdate(this IDisksOperations operations, string labName, string userName, string name, Disk disk) + { + return ((IDisksOperations)operations).CreateOrUpdateAsync(labName, userName, name, disk).GetAwaiter().GetResult(); + } - /// - /// Detach and break the lease of the disk attached to the virtual machine. - /// This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Properties of the disk to detach. - /// - public static void Detach(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDisksOperations operations, string labName, string userName, string name, Disk disk, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) { - operations.DetachAsync(labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void Delete(this IDisksOperations operations, string labName, string userName, string name) + { + ((IDisksOperations)operations).DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } - /// - /// Detach and break the lease of the disk attached to the virtual machine. - /// This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Properties of the disk to detach. - /// - /// - /// The cancellation token. - /// - public static async Task DetachAsync(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IDisksOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void Attach(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + { + ((IDisksOperations)operations).AttachAsync(labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing disk. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// A Disk. - /// - public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string labName, string userName, string name, Disk disk) - { - return operations.BeginCreateOrUpdateAsync(labName, userName, name, disk).GetAwaiter().GetResult(); - } + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task AttachAsync(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.AttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void Detach(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + { + ((IDisksOperations)operations).DetachAsync(labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing disk. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// A Disk. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IDisksOperations operations, string labName, string userName, string name, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DetachAsync(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string labName, string userName, string name, Disk disk) + { + return ((IDisksOperations)operations).BeginCreateOrUpdateAsync(labName, userName, name, disk).GetAwaiter().GetResult(); + } - /// - /// Delete disk. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - public static void BeginDelete(this IDisksOperations operations, string labName, string userName, string name) + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IDisksOperations operations, string labName, string userName, string name, Disk disk, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) { - operations.BeginDeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void BeginDelete(this IDisksOperations operations, string labName, string userName, string name) + { + ((IDisksOperations)operations).BeginDeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } - /// - /// Delete disk. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IDisksOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IDisksOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void BeginAttach(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + { + ((IDisksOperations)operations).BeginAttachAsync(labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + } - /// - /// Attach and create the lease of the disk to the virtual machine. This - /// operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Properties of the disk to attach. - /// - public static void BeginAttach(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) - { - operations.BeginAttachAsync(labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); - } + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginAttachAsync(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginAttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void BeginDetach(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + { + ((IDisksOperations)operations).BeginDetachAsync(labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + } - /// - /// Attach and create the lease of the disk to the virtual machine. This - /// operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Properties of the disk to attach. - /// - /// - /// The cancellation token. - /// - public static async Task BeginAttachAsync(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginAttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Detach and break the lease of the disk attached to the virtual machine. - /// This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Properties of the disk to detach. - /// - public static void BeginDetach(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) - { - operations.BeginDetachAsync(labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); - } + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDetachAsync(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IDisksOperations operations, string nextPageLink) + { + return ((IDisksOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Detach and break the lease of the disk attached to the virtual machine. - /// This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the disk. - /// - /// - /// Properties of the disk to detach. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDetachAsync(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IDisksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - (await operations.BeginDetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// List disks in a given user profile. - /// - /// - /// 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(); - } - - /// - /// List disks in a given user profile. - /// - /// - /// 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs index 1aad7b39f920..49c78070be08 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// EnvironmentsOperations operations. /// - internal partial class EnvironmentsOperations : IServiceOperations, IEnvironmentsOperations + internal partial class EnvironmentsOperations : Microsoft.Rest.IServiceOperations, IEnvironmentsOperations { /// /// Initializes a new instance of the EnvironmentsOperations class. @@ -37,13 +24,13 @@ internal partial class EnvironmentsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal EnvironmentsOperations(DevTestLabsClient client) + internal EnvironmentsOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,28 +41,28 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// List environments in a given user profile. /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the user profile. /// - /// - /// 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 /// /// @@ -84,85 +71,98 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _dtlEnvironment = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_dtlEnvironment)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_dtlEnvironment); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -174,55 +174,56 @@ internal EnvironmentsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -232,9 +233,10 @@ internal EnvironmentsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -245,25 +247,29 @@ internal EnvironmentsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get environment. /// @@ -278,7 +284,7 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// /// Specify the $expand query. Example: - /// 'properties($select=deploymentProperties)' + /// 'properties($select=deploymentProperties)' /// /// /// Headers that will be added to request. @@ -286,13 +292,13 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -301,87 +307,101 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -393,55 +413,56 @@ internal EnvironmentsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -451,9 +472,10 @@ internal EnvironmentsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -464,25 +486,29 @@ internal EnvironmentsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing environment. This operation can take a while /// to complete. @@ -500,16 +526,16 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// An environment, which is essentially an ARM template deployment. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -525,16 +551,16 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// The name of the environment. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -559,13 +585,13 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -574,87 +600,101 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (dtlEnvironment == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dtlEnvironment"); + } + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (dtlEnvironment == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dtlEnvironment"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); + tracingParameters.Add("dtlEnvironment", dtlEnvironment); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -666,61 +706,62 @@ internal EnvironmentsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(dtlEnvironment != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dtlEnvironment, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(dtlEnvironment, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -730,9 +771,10 @@ internal EnvironmentsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -743,16 +785,16 @@ internal EnvironmentsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -761,25 +803,29 @@ internal EnvironmentsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete environment. This operation can take a while to complete. /// @@ -798,10 +844,10 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -810,82 +856,95 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -897,55 +956,56 @@ internal EnvironmentsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -955,20 +1015,25 @@ internal EnvironmentsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List environments in a given user profile. /// @@ -981,13 +1046,13 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -996,51 +1061,54 @@ internal EnvironmentsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1052,55 +1120,56 @@ internal EnvironmentsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1110,9 +1179,10 @@ internal EnvironmentsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1123,24 +1193,28 @@ internal EnvironmentsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs index ac5a514d6717..b45d7342d619 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs @@ -1,354 +1,325 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for EnvironmentsOperations. + /// Extension methods for EnvironmentsOperations /// public static partial class EnvironmentsOperationsExtensions { - /// - /// List environments in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IEnvironmentsOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List environments in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IEnvironmentsOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get environment. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($select=deploymentProperties)' - /// - public static DtlEnvironment Get(this IEnvironmentsOperations operations, string labName, string userName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get environment. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($select=deploymentProperties)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing environment. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// An environment, which is essentially an ARM template deployment. - /// - public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment) - { - return operations.CreateOrUpdateAsync(labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); - } + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static Microsoft.Rest.Azure.IPage List(this IEnvironmentsOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IEnvironmentsOperations)operations).ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing environment. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// An environment, which is essentially an ARM template deployment. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IEnvironmentsOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get environment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + public static DtlEnvironment Get(this IEnvironmentsOperations operations, string labName, string userName, string name, string expand = default(string)) + { + return ((IEnvironmentsOperations)operations).GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Delete environment. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - public static void Delete(this IEnvironmentsOperations operations, string labName, string userName, string name) + /// + /// Get environment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment) + { + return ((IEnvironmentsOperations)operations).CreateOrUpdateAsync(labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + } - /// - /// Delete environment. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static void Delete(this IEnvironmentsOperations operations, string labName, string userName, string name) + { + ((IEnvironmentsOperations)operations).DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing environment. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// An environment, which is essentially an ARM template deployment. - /// - public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment) - { - return operations.BeginCreateOrUpdateAsync(labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); - } + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment) + { + return ((IEnvironmentsOperations)operations).BeginCreateOrUpdateAsync(labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing environment. This operation can take a while - /// to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// An environment, which is essentially an ARM template deployment. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static void BeginDelete(this IEnvironmentsOperations operations, string labName, string userName, string name) + { + ((IEnvironmentsOperations)operations).BeginDeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } - /// - /// Delete environment. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - public static void BeginDelete(this IEnvironmentsOperations operations, string labName, string userName, string name) - { - operations.BeginDeleteAsync(labName, userName, name).GetAwaiter().GetResult(); - } + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IEnvironmentsOperations operations, string nextPageLink) + { + return ((IEnvironmentsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Delete environment. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the environment. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IEnvironmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - (await operations.BeginDeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// List environments in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IEnvironmentsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List environments in a given user profile. - /// - /// - /// 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 IEnvironmentsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs index 686196b0e236..4905e26b3efe 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// FormulasOperations operations. /// - internal partial class FormulasOperations : IServiceOperations, IFormulasOperations + internal partial class FormulasOperations : Microsoft.Rest.IServiceOperations, IFormulasOperations { /// /// Initializes a new instance of the FormulasOperations class. @@ -37,13 +24,13 @@ internal partial class FormulasOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal FormulasOperations(DevTestLabsClient client) + internal FormulasOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal FormulasOperations(DevTestLabsClient client) /// /// List formulas in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _formula = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_formula)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_formula); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal FormulasOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal FormulasOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal FormulasOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get formula. /// @@ -265,7 +270,7 @@ internal FormulasOperations(DevTestLabsClient client) /// The name of the formula. /// /// - /// Specify the $expand query. Example: 'properties($select=description)' + /// Specify the $expand query. Example: 'properties($select=description)' /// /// /// Headers that will be added to request. @@ -273,13 +278,13 @@ internal FormulasOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -288,81 +293,94 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -374,55 +392,56 @@ internal FormulasOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -432,9 +451,10 @@ internal FormulasOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -445,25 +465,29 @@ internal FormulasOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing Formula. This operation can take a while to /// complete. @@ -478,16 +502,16 @@ internal FormulasOperations(DevTestLabsClient client) /// A formula for creating a VM, specifying an image base and other parameters /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, formula, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, formula, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -505,10 +529,10 @@ internal FormulasOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -517,76 +541,88 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -598,55 +634,56 @@ internal FormulasOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -656,20 +693,25 @@ internal FormulasOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing Formula. This operation can take a while to /// complete. @@ -689,13 +731,13 @@ internal FormulasOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -704,81 +746,94 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (formula == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "formula"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (formula == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "formula"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("formula", formula); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -790,61 +845,62 @@ internal FormulasOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(formula != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(formula, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(formula, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -854,9 +910,10 @@ internal FormulasOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -867,16 +924,16 @@ internal FormulasOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -885,25 +942,29 @@ internal FormulasOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List formulas in a given lab. /// @@ -916,13 +977,13 @@ internal FormulasOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -931,51 +992,54 @@ internal FormulasOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -987,55 +1051,56 @@ internal FormulasOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1045,9 +1110,10 @@ internal FormulasOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1058,24 +1124,28 @@ internal FormulasOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs index 91254b87a009..80f0ef92faba 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs @@ -1,279 +1,251 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for FormulasOperations. + /// Extension methods for FormulasOperations /// public static partial class FormulasOperationsExtensions { - /// - /// List formulas in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IFormulasOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List formulas in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IFormulasOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IFormulasOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IFormulasOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get formula. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// Specify the $expand query. Example: 'properties($select=description)' - /// - public static Formula Get(this IFormulasOperations operations, string labName, string name, string expand = default(string)) + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IFormulasOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Get formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + public static Formula Get(this IFormulasOperations operations, string labName, string name, string expand = default(string)) + { + return ((IFormulasOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Get formula. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// Specify the $expand query. Example: 'properties($select=description)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IFormulasOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IFormulasOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + public static Formula CreateOrUpdate(this IFormulasOperations operations, string labName, string name, Formula formula) + { + return ((IFormulasOperations)operations).CreateOrUpdateAsync(labName, name, formula).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing Formula. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// A formula for creating a VM, specifying an image base and other parameters - /// - public static Formula CreateOrUpdate(this IFormulasOperations operations, string labName, string name, Formula formula) + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IFormulasOperations operations, string labName, string name, Formula formula, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, formula, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(labName, name, formula).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Delete formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + public static void Delete(this IFormulasOperations operations, string labName, string name) + { + ((IFormulasOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing Formula. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// A formula for creating a VM, specifying an image base and other parameters - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IFormulasOperations operations, string labName, string name, Formula formula, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, formula, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete formula. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - public static void Delete(this IFormulasOperations operations, string labName, string name) - { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); - } + /// + /// Delete formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IFormulasOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + public static Formula BeginCreateOrUpdate(this IFormulasOperations operations, string labName, string name, Formula formula) + { + return ((IFormulasOperations)operations).BeginCreateOrUpdateAsync(labName, name, formula).GetAwaiter().GetResult(); + } - /// - /// Delete formula. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IFormulasOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IFormulasOperations operations, string labName, string name, Formula formula, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, formula, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IFormulasOperations operations, string nextPageLink) + { + return ((IFormulasOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing Formula. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// A formula for creating a VM, specifying an image base and other parameters - /// - public static Formula BeginCreateOrUpdate(this IFormulasOperations operations, string labName, string name, Formula formula) + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IFormulasOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginCreateOrUpdateAsync(labName, name, formula).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Create or replace an existing Formula. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the formula. - /// - /// - /// A formula for creating a VM, specifying an image base and other parameters - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IFormulasOperations operations, string labName, string name, Formula formula, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, formula, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List formulas in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IFormulasOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List formulas in a given lab. - /// - /// - /// 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 IFormulasOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs index 66ab6eaeeed4..a5650dce3df4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// GalleryImagesOperations operations. /// - internal partial class GalleryImagesOperations : IServiceOperations, IGalleryImagesOperations + internal partial class GalleryImagesOperations : Microsoft.Rest.IServiceOperations, IGalleryImagesOperations { /// /// Initializes a new instance of the GalleryImagesOperations class. @@ -37,13 +24,13 @@ internal partial class GalleryImagesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal GalleryImagesOperations(DevTestLabsClient client) + internal GalleryImagesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal GalleryImagesOperations(DevTestLabsClient client) /// /// List gallery images in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal GalleryImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _galleryImage = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_galleryImage)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_galleryImage); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal GalleryImagesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal GalleryImagesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal GalleryImagesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List gallery images in a given lab. /// @@ -267,13 +272,13 @@ internal GalleryImagesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -282,51 +287,54 @@ internal GalleryImagesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -338,55 +346,56 @@ internal GalleryImagesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -396,9 +405,10 @@ internal GalleryImagesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -409,24 +419,28 @@ internal GalleryImagesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs index 73dbcbe417f0..83ef513943a4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs @@ -1,100 +1,88 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for GalleryImagesOperations. + /// Extension methods for GalleryImagesOperations /// public static partial class GalleryImagesOperationsExtensions { - /// - /// List gallery images in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IGalleryImagesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IGalleryImagesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IGalleryImagesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// List gallery images in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IGalleryImagesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IGalleryImagesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IGalleryImagesOperations operations, string nextPageLink) + { + return ((IGalleryImagesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// List gallery images in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IGalleryImagesOperations operations, string nextPageLink) + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IGalleryImagesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// List gallery images in a given lab. - /// - /// - /// 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 IGalleryImagesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs index 80e2810b90a6..9b79d19eb5a6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// GlobalSchedulesOperations operations. /// - internal partial class GlobalSchedulesOperations : IServiceOperations, IGlobalSchedulesOperations + internal partial class GlobalSchedulesOperations : Microsoft.Rest.IServiceOperations, IGlobalSchedulesOperations { /// /// Initializes a new instance of the GlobalSchedulesOperations class. @@ -37,13 +24,13 @@ internal partial class GlobalSchedulesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal GlobalSchedulesOperations(DevTestLabsClient client) + internal GlobalSchedulesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -55,7 +42,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// List schedules in a subscription. /// /// - /// OData parameters to apply to the operation. + /// /// /// /// Headers that will be added to request. @@ -63,13 +50,13 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -78,68 +65,78 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _schedule = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_schedule)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_schedule); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -151,55 +148,56 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -209,9 +207,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -222,30 +221,34 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List schedules in a resource group. /// /// - /// OData parameters to apply to the operation. + /// /// /// /// Headers that will be added to request. @@ -253,13 +256,13 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -268,73 +271,84 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _schedule = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_schedule)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_schedule); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -346,55 +360,56 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -404,9 +419,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -417,25 +433,29 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get schedule. /// @@ -443,7 +463,7 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// The name of the schedule. /// /// - /// Specify the $expand query. Example: 'properties($select=status)' + /// Specify the $expand query. Example: 'properties($select=status)' /// /// /// Headers that will be added to request. @@ -451,13 +471,13 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -466,75 +486,87 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -546,55 +578,56 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -604,9 +637,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -617,25 +651,29 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing schedule. /// @@ -651,13 +689,13 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -666,75 +704,87 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (schedule == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (schedule == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -746,61 +796,62 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(schedule != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -810,9 +861,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -823,16 +875,16 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -841,25 +893,29 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete schedule. /// @@ -872,10 +928,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -884,70 +940,81 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -959,55 +1026,56 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1017,20 +1085,25 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Modify properties of schedules. /// @@ -1046,13 +1119,13 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1061,75 +1134,86 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (schedule == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); } - if (Client.ResourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (schedule == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1141,61 +1225,62 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(schedule != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1205,9 +1290,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1218,25 +1304,29 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Execute a schedule. This operation can take a while to complete. /// @@ -1244,20 +1334,20 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// The name of the schedule. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task ExecuteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Updates a schedule's target resource Id. This operation can take a while to + /// Updates a schedule's target resource Id. This operation can take a while to /// complete. /// /// @@ -1267,16 +1357,16 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// Properties for retargeting a virtual machine schedule. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task RetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task RetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginRetargetWithHttpMessagesAsync(name, retargetScheduleProperties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginRetargetWithHttpMessagesAsync(name, retargetScheduleProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -1291,10 +1381,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1303,70 +1393,81 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginExecuteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1378,55 +1479,56 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1436,22 +1538,27 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Updates a schedule's target resource Id. This operation can take a while to + /// Updates a schedule's target resource Id. This operation can take a while to /// complete. /// /// @@ -1466,10 +1573,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1478,75 +1585,87 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginRetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (retargetScheduleProperties == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "retargetScheduleProperties"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (retargetScheduleProperties == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "retargetScheduleProperties"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + tracingParameters.Add("retargetScheduleProperties", retargetScheduleProperties); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginRetarget", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginRetarget", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1558,61 +1677,62 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(retargetScheduleProperties != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(retargetScheduleProperties, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(retargetScheduleProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1622,20 +1742,25 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List schedules in a subscription. /// @@ -1648,13 +1773,13 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1663,51 +1788,54 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1719,55 +1847,56 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1777,9 +1906,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1790,25 +1920,29 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List schedules in a resource group. /// @@ -1821,13 +1955,13 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1836,51 +1970,54 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1892,55 +2029,56 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1950,9 +2088,10 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1963,24 +2102,28 @@ internal GlobalSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs index 261d7ec5590b..6bd3cd7ffd4d 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs @@ -1,453 +1,407 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for GlobalSchedulesOperations. + /// Extension methods for GlobalSchedulesOperations /// public static partial class GlobalSchedulesOperationsExtensions { - /// - /// List schedules in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListBySubscription(this IGlobalSchedulesOperations operations, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List schedules in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IGlobalSchedulesOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List schedules in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListByResourceGroup(this IGlobalSchedulesOperations operations, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListByResourceGroupAsync(odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List schedules in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IGlobalSchedulesOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// List schedules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + public static Microsoft.Rest.Azure.IPage ListBySubscription(this IGlobalSchedulesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IGlobalSchedulesOperations)operations).ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - public static Schedule Get(this IGlobalSchedulesOperations operations, string name, string expand = default(string)) + /// + /// List schedules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this IGlobalSchedulesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(name, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// List schedules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this IGlobalSchedulesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IGlobalSchedulesOperations)operations).ListByResourceGroupAsync(odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IGlobalSchedulesOperations operations, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List schedules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this IGlobalSchedulesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this IGlobalSchedulesOperations operations, string name, string expand = default(string)) + { + return ((IGlobalSchedulesOperations)operations).GetAsync(name, expand).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations, string name, Schedule schedule) + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IGlobalSchedulesOperations operations, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(name, schedule).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations, string name, Schedule schedule) + { + return ((IGlobalSchedulesOperations)operations).CreateOrUpdateAsync(name, schedule).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IGlobalSchedulesOperations operations, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IGlobalSchedulesOperations operations, string name, Schedule schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, schedule, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, schedule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this IGlobalSchedulesOperations operations, string name) + { + ((IGlobalSchedulesOperations)operations).DeleteAsync(name).GetAwaiter().GetResult(); + } - /// - /// Delete schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - public static void Delete(this IGlobalSchedulesOperations operations, string name) - { - operations.DeleteAsync(name).GetAwaiter().GetResult(); - } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IGlobalSchedulesOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static Schedule Update(this IGlobalSchedulesOperations operations, string name, ScheduleFragment schedule) + { + return ((IGlobalSchedulesOperations)operations).UpdateAsync(name, schedule).GetAwaiter().GetResult(); + } - /// - /// Delete schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IGlobalSchedulesOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IGlobalSchedulesOperations operations, string name, ScheduleFragment schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(name, schedule, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this IGlobalSchedulesOperations operations, string name) + { + ((IGlobalSchedulesOperations)operations).ExecuteAsync(name).GetAwaiter().GetResult(); + } - /// - /// Modify properties of schedules. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - public static Schedule Update(this IGlobalSchedulesOperations operations, string name, ScheduleFragment schedule) - { - return operations.UpdateAsync(name, schedule).GetAwaiter().GetResult(); - } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ExecuteAsync(this IGlobalSchedulesOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void Retarget(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties) + { + ((IGlobalSchedulesOperations)operations).RetargetAsync(name, retargetScheduleProperties).GetAwaiter().GetResult(); + } - /// - /// Modify properties of schedules. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IGlobalSchedulesOperations operations, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(name, schedule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task RetargetAsync(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.RetargetWithHttpMessagesAsync(name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this IGlobalSchedulesOperations operations, string name) + { + ((IGlobalSchedulesOperations)operations).BeginExecuteAsync(name).GetAwaiter().GetResult(); + } - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - public static void Execute(this IGlobalSchedulesOperations operations, string name) - { - operations.ExecuteAsync(name).GetAwaiter().GetResult(); - } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginExecuteAsync(this IGlobalSchedulesOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void BeginRetarget(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties) + { + ((IGlobalSchedulesOperations)operations).BeginRetargetAsync(name, retargetScheduleProperties).GetAwaiter().GetResult(); + } - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteAsync(this IGlobalSchedulesOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ExecuteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginRetargetAsync(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginRetargetWithHttpMessagesAsync(name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List schedules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListBySubscriptionNext(this IGlobalSchedulesOperations operations, string nextPageLink) + { + return ((IGlobalSchedulesOperations)operations).ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Updates a schedule's target resource Id. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// Properties for retargeting a virtual machine schedule. - /// - public static void Retarget(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties) + /// + /// List schedules 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 System.Threading.Tasks.Task> ListBySubscriptionNextAsync(this IGlobalSchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - operations.RetargetAsync(name, retargetScheduleProperties).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// List schedules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this IGlobalSchedulesOperations operations, string nextPageLink) + { + return ((IGlobalSchedulesOperations)operations).ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Updates a schedule's target resource Id. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// Properties for retargeting a virtual machine schedule. - /// - /// - /// The cancellation token. - /// - public static async Task RetargetAsync(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List schedules 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 System.Threading.Tasks.Task> ListByResourceGroupNextAsync(this IGlobalSchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - (await operations.RetargetWithHttpMessagesAsync(name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - public static void BeginExecute(this IGlobalSchedulesOperations operations, string name) - { - operations.BeginExecuteAsync(name).GetAwaiter().GetResult(); - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task BeginExecuteAsync(this IGlobalSchedulesOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginExecuteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates a schedule's target resource Id. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// Properties for retargeting a virtual machine schedule. - /// - public static void BeginRetarget(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties) - { - operations.BeginRetargetAsync(name, retargetScheduleProperties).GetAwaiter().GetResult(); - } - - /// - /// Updates a schedule's target resource Id. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the schedule. - /// - /// - /// Properties for retargeting a virtual machine schedule. - /// - /// - /// The cancellation token. - /// - public static async Task BeginRetargetAsync(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginRetargetWithHttpMessagesAsync(name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List schedules 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 IGlobalSchedulesOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List schedules 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 IGlobalSchedulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List schedules 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 IGlobalSchedulesOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List schedules 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 IGlobalSchedulesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs index eb3ccba681f2..0d3618587104 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// ArmTemplatesOperations operations. @@ -27,15 +16,18 @@ public partial interface IArmTemplatesOperations /// /// List azure resource manager templates in a given artifact source. /// + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the artifact source. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -48,13 +40,14 @@ public partial interface IArmTemplatesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get azure resource manager template. /// + /// + /// Get azure resource manager template. + /// /// /// The name of the lab. /// @@ -65,8 +58,7 @@ public partial interface IArmTemplatesOperations /// The name of the azure Resource Manager template. /// /// - /// Specify the $expand query. Example: - /// 'properties($select=displayName)' + /// Specify the $expand query. Example: 'properties($select=displayName)' /// /// /// The headers that will be added to request. @@ -80,13 +72,14 @@ public partial interface IArmTemplatesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List azure resource manager templates in a given artifact source. /// + /// + /// List azure resource manager templates in a given artifact source. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -102,9 +95,7 @@ public partial interface IArmTemplatesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs index 0a9f812ea6ef..e98369fabe1d 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// ArtifactSourcesOperations operations. @@ -27,12 +16,15 @@ public partial interface IArtifactSourcesOperations /// /// List artifact sources in a given lab. /// + /// + /// List artifact sources in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get artifact source. /// + /// + /// Get artifact source. + /// /// /// The name of the lab. /// @@ -59,8 +52,7 @@ public partial interface IArtifactSourcesOperations /// The name of the artifact source. /// /// - /// Specify the $expand query. Example: - /// 'properties($select=displayName)' + /// Specify the $expand query. Example: 'properties($select=displayName)' /// /// /// The headers that will be added to request. @@ -74,13 +66,14 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing artifact source. /// + /// + /// Create or replace an existing artifact source. + /// /// /// The name of the lab. /// @@ -102,13 +95,14 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ArtifactSource artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ArtifactSource artifactSource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete artifact source. /// + /// + /// Delete artifact source. + /// /// /// The name of the lab. /// @@ -124,13 +118,14 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of artifact sources. /// + /// + /// Modify properties of artifact sources. + /// /// /// The name of the lab. /// @@ -152,13 +147,14 @@ public partial interface IArtifactSourcesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string labName, string name, ArtifactSourceFragment artifactSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, ArtifactSourceFragment artifactSource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List artifact sources in a given lab. /// + /// + /// List artifact sources in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -174,9 +170,7 @@ public partial interface IArtifactSourcesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs index 4f0966887c54..1022623e393e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// ArtifactsOperations operations. @@ -27,15 +16,18 @@ public partial interface IArtifactsOperations /// /// List artifacts in a given artifact source. /// + /// + /// List artifacts in a given artifact source. + /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the artifact source. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -48,13 +40,14 @@ public partial interface IArtifactsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get artifact. /// + /// + /// Get artifact. + /// /// /// The name of the lab. /// @@ -65,7 +58,7 @@ public partial interface IArtifactsOperations /// The name of the artifact. /// /// - /// Specify the $expand query. Example: 'properties($select=title)' + /// Specify the $expand query. Example: 'properties($select=title)' /// /// /// The headers that will be added to request. @@ -79,15 +72,16 @@ public partial interface IArtifactsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Generates an ARM template for the given artifact, uploads the - /// required files to a storage account, and validates the generated - /// artifact. + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. /// + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// /// /// The name of the lab. /// @@ -112,13 +106,14 @@ public partial interface IArtifactsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GenerateArmTemplateWithHttpMessagesAsync(string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GenerateArmTemplateWithHttpMessagesAsync(string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List artifacts in a given artifact source. /// + /// + /// List artifacts in a given artifact source. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -134,9 +129,7 @@ public partial interface IArtifactsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs index 322320d5d4c2..d100c77cf9a7 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// CostsOperations operations. @@ -26,6 +16,9 @@ public partial interface ICostsOperations /// /// Get cost. /// + /// + /// Get cost. + /// /// /// The name of the lab. /// @@ -33,8 +26,7 @@ public partial interface ICostsOperations /// The name of the cost. /// /// - /// Specify the $expand query. Example: - /// 'properties($expand=labCostDetails)' + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' /// /// /// The headers that will be added to request. @@ -48,13 +40,14 @@ public partial interface ICostsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing cost. /// + /// + /// Create or replace an existing cost. + /// /// /// The name of the lab. /// @@ -76,9 +69,7 @@ public partial interface ICostsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabCost labCost, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabCost labCost, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs index 621ee9e7fe7a..a26a3082aedc 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// CustomImagesOperations operations. @@ -27,12 +16,15 @@ public partial interface ICustomImagesOperations /// /// List custom images in a given lab. /// + /// + /// List custom images in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface ICustomImagesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get custom image. /// + /// + /// Get custom image. + /// /// /// The name of the lab. /// @@ -59,7 +52,7 @@ public partial interface ICustomImagesOperations /// The name of the custom image. /// /// - /// Specify the $expand query. Example: 'properties($select=vm)' + /// Specify the $expand query. Example: 'properties($select=vm)' /// /// /// The headers that will be added to request. @@ -73,14 +66,16 @@ public partial interface ICustomImagesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing custom image. This operation can take - /// a while to complete. + /// Create or replace an existing custom image. This operation can take a while + /// to complete. /// + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// /// /// The name of the lab. /// @@ -102,13 +97,14 @@ public partial interface ICustomImagesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete custom image. This operation can take a while to complete. /// + /// + /// Delete custom image. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -124,14 +120,16 @@ public partial interface ICustomImagesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing custom image. This operation can take - /// a while to complete. + /// Create or replace an existing custom image. This operation can take a while + /// to complete. /// + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// /// /// The name of the lab. /// @@ -153,13 +151,14 @@ public partial interface ICustomImagesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete custom image. This operation can take a while to complete. /// + /// + /// Delete custom image. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -175,13 +174,14 @@ public partial interface ICustomImagesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List custom images in a given lab. /// + /// + /// List custom images in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -197,9 +197,7 @@ public partial interface ICustomImagesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs index 4d0c6b6f5cd4..b0200bb786c5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs @@ -1,24 +1,18 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; /// /// The DevTest Labs Client. /// - public partial interface IDevTestLabsClient : System.IDisposable + public partial interface IDevTestLabsClient : System.IDisposable { /// /// The base URI of the service. @@ -28,166 +22,172 @@ public partial interface IDevTestLabsClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - JsonSerializerSettings SerializationSettings { get; } + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - JsonSerializerSettings DeserializationSettings { get; } + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - ServiceClientCredentials Credentials { get; } + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + /// - /// Client API version. + /// The API version to use for this operation. /// - string ApiVersion { get; } + string ApiVersion { get;} + /// /// The name of the resource group. /// - string ResourceGroupName { get; set; } + string ResourceGroupName { get; set;} + /// /// The subscription ID. /// - string SubscriptionId { get; set; } + string SubscriptionId { get; set;} + /// /// The preferred language for the response. /// - string AcceptLanguage { get; set; } + string AcceptLanguage { get; set;} + /// /// The retry timeout in seconds for Long Running Operations. Default - /// value is 30. + /// /// value is 30. /// - int? LongRunningOperationRetryTimeout { get; set; } + 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. + /// /// 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; } + bool? GenerateClientRequestId { get; set;} /// - /// Gets the IProviderOperations. + /// Gets the IProviderOperations /// IProviderOperations ProviderOperations { get; } /// - /// Gets the ILabsOperations. + /// Gets the ILabsOperations /// ILabsOperations Labs { get; } /// - /// Gets the IOperations. + /// Gets the IOperations /// IOperations Operations { get; } /// - /// Gets the IGlobalSchedulesOperations. + /// Gets the IGlobalSchedulesOperations /// IGlobalSchedulesOperations GlobalSchedules { get; } /// - /// Gets the IArtifactSourcesOperations. + /// Gets the IArtifactSourcesOperations /// IArtifactSourcesOperations ArtifactSources { get; } /// - /// Gets the IArmTemplatesOperations. + /// Gets the IArmTemplatesOperations /// IArmTemplatesOperations ArmTemplates { get; } /// - /// Gets the IArtifactsOperations. + /// Gets the IArtifactsOperations /// IArtifactsOperations Artifacts { get; } /// - /// Gets the ICostsOperations. + /// Gets the ICostsOperations /// ICostsOperations Costs { get; } /// - /// Gets the ICustomImagesOperations. + /// Gets the ICustomImagesOperations /// ICustomImagesOperations CustomImages { get; } /// - /// Gets the IFormulasOperations. + /// Gets the IFormulasOperations /// IFormulasOperations Formulas { get; } /// - /// Gets the IGalleryImagesOperations. + /// Gets the IGalleryImagesOperations /// IGalleryImagesOperations GalleryImages { get; } /// - /// Gets the INotificationChannelsOperations. + /// Gets the INotificationChannelsOperations /// INotificationChannelsOperations NotificationChannels { get; } /// - /// Gets the IPolicySetsOperations. + /// Gets the IPolicySetsOperations /// IPolicySetsOperations PolicySets { get; } /// - /// Gets the IPoliciesOperations. + /// Gets the IPoliciesOperations /// IPoliciesOperations Policies { get; } /// - /// Gets the ISchedulesOperations. + /// Gets the ISchedulesOperations /// ISchedulesOperations Schedules { get; } /// - /// Gets the IServiceRunnersOperations. + /// Gets the IServiceRunnersOperations /// IServiceRunnersOperations ServiceRunners { get; } /// - /// Gets the IUsersOperations. + /// Gets the IUsersOperations /// IUsersOperations Users { get; } /// - /// Gets the IDisksOperations. + /// Gets the IDisksOperations /// IDisksOperations Disks { get; } /// - /// Gets the IEnvironmentsOperations. + /// Gets the IEnvironmentsOperations /// IEnvironmentsOperations Environments { get; } /// - /// Gets the ISecretsOperations. + /// Gets the ISecretsOperations /// ISecretsOperations Secrets { get; } /// - /// Gets the IVirtualMachinesOperations. + /// Gets the IVirtualMachinesOperations /// IVirtualMachinesOperations VirtualMachines { get; } /// - /// Gets the IVirtualMachineSchedulesOperations. + /// Gets the IVirtualMachineSchedulesOperations /// IVirtualMachineSchedulesOperations VirtualMachineSchedules { get; } /// - /// Gets the IVirtualNetworksOperations. + /// Gets the IVirtualNetworksOperations /// IVirtualNetworksOperations VirtualNetworks { get; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs index f9b433fa50dc..419fd493d6aa 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// DisksOperations operations. @@ -27,15 +16,18 @@ public partial interface IDisksOperations /// /// List disks in a given user profile. /// + /// + /// List disks in a given user profile. + /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the user profile. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -48,13 +40,14 @@ public partial interface IDisksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get disk. /// + /// + /// Get disk. + /// /// /// The name of the lab. /// @@ -65,7 +58,7 @@ public partial interface IDisksOperations /// The name of the disk. /// /// - /// Specify the $expand query. Example: 'properties($select=diskType)' + /// Specify the $expand query. Example: 'properties($select=diskType)' /// /// /// The headers that will be added to request. @@ -79,14 +72,16 @@ public partial interface IDisksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing disk. This operation can take a while - /// to complete. + /// Create or replace an existing disk. This operation can take a while to + /// complete. /// + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -111,13 +106,14 @@ public partial interface IDisksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete disk. This operation can take a while to complete. /// + /// + /// Delete disk. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -136,14 +132,16 @@ public partial interface IDisksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Attach and create the lease of the disk to the virtual machine. - /// This operation can take a while to complete. + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. /// + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -165,14 +163,16 @@ public partial interface IDisksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task AttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task AttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Detach and break the lease of the disk attached to the virtual - /// machine. This operation can take a while to complete. + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. /// + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -194,14 +194,16 @@ public partial interface IDisksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing disk. This operation can take a while - /// to complete. + /// Create or replace an existing disk. This operation can take a while to + /// complete. /// + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -226,13 +228,14 @@ public partial interface IDisksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete disk. This operation can take a while to complete. /// + /// + /// Delete disk. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -251,14 +254,16 @@ public partial interface IDisksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Attach and create the lease of the disk to the virtual machine. - /// This operation can take a while to complete. + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. /// + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -280,14 +285,16 @@ public partial interface IDisksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginAttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginAttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Detach and break the lease of the disk attached to the virtual - /// machine. This operation can take a while to complete. + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. /// + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -309,13 +316,14 @@ public partial interface IDisksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List disks in a given user profile. /// + /// + /// List disks in a given user profile. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -331,9 +339,7 @@ public partial interface IDisksOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs index ab482be08e9a..cdeb193ffd15 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// EnvironmentsOperations operations. @@ -27,15 +16,18 @@ public partial interface IEnvironmentsOperations /// /// List environments in a given user profile. /// + /// + /// List environments in a given user profile. + /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the user profile. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -48,13 +40,14 @@ public partial interface IEnvironmentsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get environment. /// + /// + /// Get environment. + /// /// /// The name of the lab. /// @@ -66,7 +59,7 @@ public partial interface IEnvironmentsOperations /// /// /// Specify the $expand query. Example: - /// 'properties($select=deploymentProperties)' + /// 'properties($select=deploymentProperties)' /// /// /// The headers that will be added to request. @@ -80,14 +73,16 @@ public partial interface IEnvironmentsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing environment. This operation can take - /// a while to complete. + /// Create or replace an existing environment. This operation can take a while + /// to complete. /// + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// /// /// The name of the lab. /// @@ -112,13 +107,14 @@ public partial interface IEnvironmentsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete environment. This operation can take a while to complete. /// + /// + /// Delete environment. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -137,14 +133,16 @@ public partial interface IEnvironmentsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing environment. This operation can take - /// a while to complete. + /// Create or replace an existing environment. This operation can take a while + /// to complete. /// + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// /// /// The name of the lab. /// @@ -169,13 +167,14 @@ public partial interface IEnvironmentsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete environment. This operation can take a while to complete. /// + /// + /// Delete environment. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -194,13 +193,14 @@ public partial interface IEnvironmentsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List environments in a given user profile. /// + /// + /// List environments in a given user profile. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -216,9 +216,7 @@ public partial interface IEnvironmentsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs index f24793a8023e..3be086a75344 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// FormulasOperations operations. @@ -27,12 +16,15 @@ public partial interface IFormulasOperations /// /// List formulas in a given lab. /// + /// + /// List formulas in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface IFormulasOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get formula. /// + /// + /// Get formula. + /// /// /// The name of the lab. /// @@ -59,8 +52,7 @@ public partial interface IFormulasOperations /// The name of the formula. /// /// - /// Specify the $expand query. Example: - /// 'properties($select=description)' + /// Specify the $expand query. Example: 'properties($select=description)' /// /// /// The headers that will be added to request. @@ -74,14 +66,16 @@ public partial interface IFormulasOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing Formula. This operation can take a - /// while to complete. + /// Create or replace an existing Formula. This operation can take a while to + /// complete. /// + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -89,8 +83,7 @@ public partial interface IFormulasOperations /// The name of the formula. /// /// - /// A formula for creating a VM, specifying an image base and other - /// parameters + /// A formula for creating a VM, specifying an image base and other parameters /// /// /// The headers that will be added to request. @@ -104,13 +97,14 @@ public partial interface IFormulasOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete formula. /// + /// + /// Delete formula. + /// /// /// The name of the lab. /// @@ -126,14 +120,16 @@ public partial interface IFormulasOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing Formula. This operation can take a - /// while to complete. + /// Create or replace an existing Formula. This operation can take a while to + /// complete. /// + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -141,8 +137,7 @@ public partial interface IFormulasOperations /// The name of the formula. /// /// - /// A formula for creating a VM, specifying an image base and other - /// parameters + /// A formula for creating a VM, specifying an image base and other parameters /// /// /// The headers that will be added to request. @@ -156,13 +151,14 @@ public partial interface IFormulasOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List formulas in a given lab. /// + /// + /// List formulas in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -178,9 +174,7 @@ public partial interface IFormulasOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs index ca0b026cc549..d784ec710d03 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// GalleryImagesOperations operations. @@ -27,12 +16,15 @@ public partial interface IGalleryImagesOperations /// /// List gallery images in a given lab. /// + /// + /// List gallery images in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface IGalleryImagesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List gallery images in a given lab. /// + /// + /// List gallery images in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -67,9 +60,7 @@ public partial interface IGalleryImagesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs index 5158647efdf3..21a762f1a3c4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// GlobalSchedulesOperations operations. @@ -27,8 +16,11 @@ public partial interface IGlobalSchedulesOperations /// /// List schedules in a subscription. /// + /// + /// List schedules in a subscription. + /// /// - /// OData parameters to apply to the operation. + /// /// /// /// The headers that will be added to request. @@ -42,15 +34,16 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List schedules in a resource group. /// + /// + /// List schedules in a resource group. + /// /// - /// OData parameters to apply to the operation. + /// /// /// /// The headers that will be added to request. @@ -64,18 +57,19 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByResourceGroupWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get schedule. /// + /// + /// Get schedule. + /// /// /// The name of the schedule. /// /// - /// Specify the $expand query. Example: 'properties($select=status)' + /// Specify the $expand query. Example: 'properties($select=status)' /// /// /// The headers that will be added to request. @@ -89,13 +83,14 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing schedule. /// + /// + /// Create or replace an existing schedule. + /// /// /// The name of the schedule. /// @@ -114,13 +109,14 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete schedule. /// + /// + /// Delete schedule. + /// /// /// The name of the schedule. /// @@ -133,13 +129,14 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of schedules. /// + /// + /// Modify properties of schedules. + /// /// /// The name of the schedule. /// @@ -158,13 +155,14 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Execute a schedule. This operation can take a while to complete. /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// /// /// The name of the schedule. /// @@ -177,14 +175,16 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task ExecuteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Updates a schedule's target resource Id. This operation can take a - /// while to complete. + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. /// + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// /// /// The name of the schedule. /// @@ -200,13 +200,14 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task RetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task RetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Execute a schedule. This operation can take a while to complete. /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// /// /// The name of the schedule. /// @@ -219,14 +220,16 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginExecuteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Updates a schedule's target resource Id. This operation can take a - /// while to complete. + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. /// + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// /// /// The name of the schedule. /// @@ -242,13 +245,14 @@ public partial interface IGlobalSchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginRetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginRetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List schedules in a subscription. /// + /// + /// List schedules in a subscription. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -264,13 +268,14 @@ public partial interface IGlobalSchedulesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List schedules in a resource group. /// + /// + /// List schedules in a resource group. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -286,9 +291,7 @@ public partial interface IGlobalSchedulesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs index 0001041d5898..64a8bc4599f5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// LabsOperations operations. @@ -27,8 +16,11 @@ public partial interface ILabsOperations /// /// List labs in a subscription. /// + /// + /// List labs in a subscription. + /// /// - /// OData parameters to apply to the operation. + /// /// /// /// The headers that will be added to request. @@ -42,15 +34,16 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List labs in a resource group. /// + /// + /// List labs in a resource group. + /// /// - /// OData parameters to apply to the operation. + /// /// /// /// The headers that will be added to request. @@ -64,19 +57,20 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByResourceGroupWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get lab. /// + /// + /// Get lab. + /// /// /// The name of the lab. /// /// /// Specify the $expand query. Example: - /// 'properties($select=defaultStorageAccount)' + /// 'properties($select=defaultStorageAccount)' /// /// /// The headers that will be added to request. @@ -90,14 +84,16 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing lab. This operation can take a while - /// to complete. + /// Create or replace an existing lab. This operation can take a while to + /// complete. /// + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -116,13 +112,14 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete lab. This operation can take a while to complete. /// + /// + /// Delete lab. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -135,13 +132,14 @@ public partial interface ILabsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of labs. /// + /// + /// Modify properties of labs. + /// /// /// The name of the lab. /// @@ -160,14 +158,16 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string name, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string name, LabFragment lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Claim a random claimable virtual machine in the lab. This operation - /// can take a while to complete. + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. /// + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// /// /// The name of the lab. /// @@ -180,14 +180,16 @@ public partial interface ILabsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task ClaimAnyVmWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task ClaimAnyVmWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create virtual machines in a lab. This operation can take a while - /// to complete. + /// Create virtual machines in a lab. This operation can take a while to + /// complete. /// + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -203,14 +205,16 @@ public partial interface ILabsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task CreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task CreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Exports the lab resource usage into a storage account This - /// operation can take a while to complete. + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. /// + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// /// /// The name of the lab. /// @@ -226,13 +230,14 @@ public partial interface ILabsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task ExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task ExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Generate a URI for uploading custom disk images to a Lab. /// + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// /// /// The name of the lab. /// @@ -251,13 +256,14 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GenerateUploadUriWithHttpMessagesAsync(string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GenerateUploadUriWithHttpMessagesAsync(string name, GenerateUploadUriParameter generateUploadUriParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List disk images available for custom image creation. /// + /// + /// List disk images available for custom image creation. + /// /// /// The name of the lab. /// @@ -273,14 +279,16 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListVhdsWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListVhdsWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing lab. This operation can take a while - /// to complete. + /// Create or replace an existing lab. This operation can take a while to + /// complete. /// + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -299,13 +307,14 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete lab. This operation can take a while to complete. /// + /// + /// Delete lab. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -318,14 +327,16 @@ public partial interface ILabsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Claim a random claimable virtual machine in the lab. This operation - /// can take a while to complete. + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. /// + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// /// /// The name of the lab. /// @@ -338,14 +349,16 @@ public partial interface ILabsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginClaimAnyVmWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginClaimAnyVmWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create virtual machines in a lab. This operation can take a while - /// to complete. + /// Create virtual machines in a lab. This operation can take a while to + /// complete. /// + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -361,14 +374,16 @@ public partial interface ILabsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginCreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginCreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Exports the lab resource usage into a storage account This - /// operation can take a while to complete. + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. /// + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// /// /// The name of the lab. /// @@ -384,13 +399,14 @@ public partial interface ILabsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List labs in a subscription. /// + /// + /// List labs in a subscription. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -406,13 +422,14 @@ public partial interface ILabsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List labs in a resource group. /// + /// + /// List labs in a resource group. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -428,13 +445,14 @@ public partial interface ILabsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List disk images available for custom image creation. /// + /// + /// List disk images available for custom image creation. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -450,9 +468,7 @@ public partial interface ILabsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListVhdsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListVhdsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs index d3f90e86c2b9..30f5be91e895 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// NotificationChannelsOperations operations. @@ -27,12 +16,15 @@ public partial interface INotificationChannelsOperations /// /// List notificationchannels in a given lab. /// + /// + /// List notificationchannels in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface INotificationChannelsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get notificationchannel. /// + /// + /// Get notificationchannel. + /// /// /// The name of the lab. /// @@ -59,8 +52,7 @@ public partial interface INotificationChannelsOperations /// The name of the notificationChannel. /// /// - /// Specify the $expand query. Example: - /// 'properties($select=webHookUrl)' + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' /// /// /// The headers that will be added to request. @@ -74,13 +66,14 @@ public partial interface INotificationChannelsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing notificationChannel. /// + /// + /// Create or replace an existing notificationChannel. + /// /// /// The name of the lab. /// @@ -102,13 +95,14 @@ public partial interface INotificationChannelsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, NotificationChannel notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, NotificationChannel notificationChannel, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete notificationchannel. /// + /// + /// Delete notificationchannel. + /// /// /// The name of the lab. /// @@ -124,13 +118,14 @@ public partial interface INotificationChannelsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of notificationchannels. /// + /// + /// Modify properties of notificationchannels. + /// /// /// The name of the lab. /// @@ -152,13 +147,14 @@ public partial interface INotificationChannelsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string labName, string name, NotificationChannelFragment notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, NotificationChannelFragment notificationChannel, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Send notification to provided channel. /// + /// + /// Send notification to provided channel. + /// /// /// The name of the lab. /// @@ -177,13 +173,14 @@ public partial interface INotificationChannelsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task NotifyWithHttpMessagesAsync(string labName, string name, NotifyParameters notifyParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task NotifyWithHttpMessagesAsync(string labName, string name, NotifyParameters notifyParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List notificationchannels in a given lab. /// + /// + /// List notificationchannels in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -199,9 +196,7 @@ public partial interface INotificationChannelsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs index 938e9b9640ad..bdf90b917594 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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. @@ -26,6 +16,9 @@ public partial interface IOperations /// /// Get operation. /// + /// + /// Get operation. + /// /// /// The name of the location. /// @@ -44,9 +37,7 @@ public partial interface IOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string locationName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string locationName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs index f9ceb68a1ec4..a25a8af23525 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// PoliciesOperations operations. @@ -27,15 +16,18 @@ public partial interface IPoliciesOperations /// /// List policies in a given policy set. /// + /// + /// List policies in a given policy set. + /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the policy set. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -48,13 +40,14 @@ public partial interface IPoliciesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string policySetName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get policy. /// + /// + /// Get policy. + /// /// /// The name of the lab. /// @@ -65,8 +58,7 @@ public partial interface IPoliciesOperations /// The name of the policy. /// /// - /// Specify the $expand query. Example: - /// 'properties($select=description)' + /// Specify the $expand query. Example: 'properties($select=description)' /// /// /// The headers that will be added to request. @@ -80,13 +72,14 @@ public partial interface IPoliciesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string policySetName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string policySetName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing policy. /// + /// + /// Create or replace an existing policy. + /// /// /// The name of the lab. /// @@ -111,13 +104,14 @@ public partial interface IPoliciesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string policySetName, string name, Policy policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string policySetName, string name, Policy policy, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete policy. /// + /// + /// Delete policy. + /// /// /// The name of the lab. /// @@ -136,13 +130,14 @@ public partial interface IPoliciesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string policySetName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string policySetName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of policies. /// + /// + /// Modify properties of policies. + /// /// /// The name of the lab. /// @@ -167,13 +162,14 @@ public partial interface IPoliciesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string labName, string policySetName, string name, PolicyFragment policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string policySetName, string name, PolicyFragment policy, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List policies in a given policy set. /// + /// + /// List policies in a given policy set. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -189,9 +185,7 @@ public partial interface IPoliciesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs index 0fd643c2f1ad..9b53488d23c8 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// PolicySetsOperations operations. @@ -26,6 +16,9 @@ public partial interface IPolicySetsOperations /// /// Evaluates lab policy. /// + /// + /// Evaluates lab policy. + /// /// /// The name of the lab. /// @@ -47,9 +40,7 @@ public partial interface IPolicySetsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> EvaluatePoliciesWithHttpMessagesAsync(string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> EvaluatePoliciesWithHttpMessagesAsync(string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs index 4f9ea196066a..1c5b0a56092b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// ProviderOperations operations. @@ -26,6 +16,9 @@ public partial interface IProviderOperations /// /// Result of the request to list REST API operations /// + /// + /// Result of the request to list REST API operations + /// /// /// The headers that will be added to request. /// @@ -38,13 +31,14 @@ public partial interface IProviderOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Result of the request to list REST API operations /// + /// + /// Result of the request to list REST API operations + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -60,9 +54,7 @@ public partial interface IProviderOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs index 5f51eaedec39..6b4a0f3f5eb4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// SchedulesOperations operations. @@ -27,12 +16,15 @@ public partial interface ISchedulesOperations /// /// List schedules in a given lab. /// + /// + /// List schedules in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface ISchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get schedule. /// + /// + /// Get schedule. + /// /// /// The name of the lab. /// @@ -59,7 +52,7 @@ public partial interface ISchedulesOperations /// The name of the schedule. /// /// - /// Specify the $expand query. Example: 'properties($select=status)' + /// Specify the $expand query. Example: 'properties($select=status)' /// /// /// The headers that will be added to request. @@ -73,13 +66,14 @@ public partial interface ISchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing schedule. /// + /// + /// Create or replace an existing schedule. + /// /// /// The name of the lab. /// @@ -101,13 +95,14 @@ public partial interface ISchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete schedule. /// + /// + /// Delete schedule. + /// /// /// The name of the lab. /// @@ -123,13 +118,14 @@ public partial interface ISchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of schedules. /// + /// + /// Modify properties of schedules. + /// /// /// The name of the lab. /// @@ -151,13 +147,14 @@ public partial interface ISchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string labName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Execute a schedule. This operation can take a while to complete. /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -173,13 +170,14 @@ public partial interface ISchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task ExecuteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists all applicable schedules /// + /// + /// Lists all applicable schedules + /// /// /// The name of the lab. /// @@ -198,13 +196,14 @@ public partial interface ISchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListApplicableWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListApplicableWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Execute a schedule. This operation can take a while to complete. /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -220,13 +219,14 @@ public partial interface ISchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginExecuteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List schedules in a given lab. /// + /// + /// List schedules in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -242,13 +242,14 @@ public partial interface ISchedulesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists all applicable schedules /// + /// + /// Lists all applicable schedules + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -264,9 +265,7 @@ public partial interface ISchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListApplicableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListApplicableNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs index 9437c29de280..0e5c8ce5a420 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// SecretsOperations operations. @@ -27,15 +16,18 @@ public partial interface ISecretsOperations /// /// List secrets in a given user profile. /// + /// + /// List secrets in a given user profile. + /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the user profile. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -48,13 +40,14 @@ public partial interface ISecretsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get secret. /// + /// + /// Get secret. + /// /// /// The name of the lab. /// @@ -65,7 +58,7 @@ public partial interface ISecretsOperations /// The name of the secret. /// /// - /// Specify the $expand query. Example: 'properties($select=value)' + /// Specify the $expand query. Example: 'properties($select=value)' /// /// /// The headers that will be added to request. @@ -79,13 +72,14 @@ public partial interface ISecretsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing secret. /// + /// + /// Create or replace an existing secret. + /// /// /// The name of the lab. /// @@ -110,13 +104,14 @@ public partial interface ISecretsOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Secret secret, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete secret. /// + /// + /// Delete secret. + /// /// /// The name of the lab. /// @@ -135,13 +130,14 @@ public partial interface ISecretsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List secrets in a given user profile. /// + /// + /// List secrets in a given user profile. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -157,9 +153,7 @@ public partial interface ISecretsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs index 6b629dd20228..eb1a08552291 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// ServiceRunnersOperations operations. @@ -27,12 +16,15 @@ public partial interface IServiceRunnersOperations /// /// List service runners in a given lab. /// + /// + /// List service runners in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface IServiceRunnersOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get service runner. /// + /// + /// Get service runner. + /// /// /// The name of the lab. /// @@ -70,13 +63,14 @@ public partial interface IServiceRunnersOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing Service runner. /// + /// + /// Create or replace an existing Service runner. + /// /// /// The name of the lab. /// @@ -98,13 +92,14 @@ public partial interface IServiceRunnersOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ServiceRunner serviceRunner, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ServiceRunner serviceRunner, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete service runner. /// + /// + /// Delete service runner. + /// /// /// The name of the lab. /// @@ -120,13 +115,14 @@ public partial interface IServiceRunnersOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List service runners in a given lab. /// + /// + /// List service runners in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -142,9 +138,7 @@ public partial interface IServiceRunnersOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs index e8c07bf7c643..448cf98df6e5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// UsersOperations operations. @@ -27,12 +16,15 @@ public partial interface IUsersOperations /// /// List user profiles in a given lab. /// + /// + /// List user profiles in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface IUsersOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get user profile. /// + /// + /// Get user profile. + /// /// /// The name of the lab. /// @@ -59,7 +52,7 @@ public partial interface IUsersOperations /// The name of the user profile. /// /// - /// Specify the $expand query. Example: 'properties($select=identity)' + /// Specify the $expand query. Example: 'properties($select=identity)' /// /// /// The headers that will be added to request. @@ -73,13 +66,14 @@ public partial interface IUsersOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing user profile. /// + /// + /// Create or replace an existing user profile. + /// /// /// The name of the lab. /// @@ -101,13 +95,14 @@ public partial interface IUsersOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, User user, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete user profile. This operation can take a while to complete. /// + /// + /// Delete user profile. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -123,13 +118,14 @@ public partial interface IUsersOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of user profiles. /// + /// + /// Modify properties of user profiles. + /// /// /// The name of the lab. /// @@ -151,13 +147,14 @@ public partial interface IUsersOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string labName, string name, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, UserFragment user, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete user profile. This operation can take a while to complete. /// + /// + /// Delete user profile. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -173,13 +170,14 @@ public partial interface IUsersOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List user profiles in a given lab. /// + /// + /// List user profiles in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -195,9 +193,7 @@ public partial interface IUsersOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs index 52b4c4e86c9e..f13c61fe3a7a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// VirtualMachineSchedulesOperations operations. @@ -27,15 +16,18 @@ public partial interface IVirtualMachineSchedulesOperations /// /// List schedules in a given virtual machine. /// + /// + /// List schedules in a given virtual machine. + /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -48,13 +40,14 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string virtualMachineName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get schedule. /// + /// + /// Get schedule. + /// /// /// The name of the lab. /// @@ -65,7 +58,7 @@ public partial interface IVirtualMachineSchedulesOperations /// The name of the schedule. /// /// - /// Specify the $expand query. Example: 'properties($select=status)' + /// Specify the $expand query. Example: 'properties($select=status)' /// /// /// The headers that will be added to request. @@ -79,13 +72,14 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string virtualMachineName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string virtualMachineName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or replace an existing schedule. /// + /// + /// Create or replace an existing schedule. + /// /// /// The name of the lab. /// @@ -110,13 +104,14 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete schedule. /// + /// + /// Delete schedule. + /// /// /// The name of the lab. /// @@ -135,13 +130,14 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of schedules. /// + /// + /// Modify properties of schedules. + /// /// /// The name of the lab. /// @@ -166,13 +162,14 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Execute a schedule. This operation can take a while to complete. /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -191,13 +188,14 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task ExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Execute a schedule. This operation can take a while to complete. /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -216,13 +214,14 @@ public partial interface IVirtualMachineSchedulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List schedules in a given virtual machine. /// + /// + /// List schedules in a given virtual machine. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -238,9 +237,7 @@ public partial interface IVirtualMachineSchedulesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs index 5c3fa2f6c251..fb98c49c3236 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// VirtualMachinesOperations operations. @@ -27,12 +16,15 @@ public partial interface IVirtualMachinesOperations /// /// List virtual machines in a given lab. /// + /// + /// List virtual machines in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get virtual machine. /// + /// + /// Get virtual machine. + /// /// /// The name of the lab. /// @@ -60,7 +53,7 @@ public partial interface IVirtualMachinesOperations /// /// /// Specify the $expand query. Example: - /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' /// /// /// The headers that will be added to request. @@ -74,14 +67,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing Virtual machine. This operation can - /// take a while to complete. + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. /// + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// /// /// The name of the lab. /// @@ -103,14 +98,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Delete virtual machine. This operation can take a while to - /// complete. + /// Delete virtual machine. This operation can take a while to complete. /// + /// + /// Delete virtual machine. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -126,13 +121,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of virtual machines. /// + /// + /// Modify properties of virtual machines. + /// /// /// The name of the lab. /// @@ -154,14 +150,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachineFragment labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachineFragment labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Attach a new or existing data disk to virtual machine. This - /// operation can take a while to complete. + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. /// + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// /// /// The name of the lab. /// @@ -169,8 +167,7 @@ public partial interface IVirtualMachinesOperations /// The name of the virtual machine. /// /// - /// Request body for adding a new or existing data disk to a virtual - /// machine. + /// Request body for adding a new or existing data disk to a virtual machine. /// /// /// The headers that will be added to request. @@ -181,14 +178,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task AddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task AddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Apply artifacts to virtual machine. This operation can take a while - /// to complete. + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. /// + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -207,14 +206,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task ApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task ApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Take ownership of an existing virtual machine This operation can - /// take a while to complete. + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. /// + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// /// /// The name of the lab. /// @@ -230,14 +231,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task ClaimWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task ClaimWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Detach the specified disk from the virtual machine. This operation - /// can take a while to complete. + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. /// + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// /// /// The name of the lab. /// @@ -256,13 +259,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists all applicable schedules /// + /// + /// Lists all applicable schedules + /// /// /// The name of the lab. /// @@ -281,14 +285,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ListApplicableSchedulesWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ListApplicableSchedulesWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Start a virtual machine. This operation can take a while to - /// complete. + /// Start a virtual machine. This operation can take a while to complete. /// + /// + /// Start a virtual machine. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -304,13 +308,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task StartWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task StartWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Stop a virtual machine This operation can take a while to complete. /// + /// + /// Stop a virtual machine This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -326,14 +331,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task StopWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task StopWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing Virtual machine. This operation can - /// take a while to complete. + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. /// + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// /// /// The name of the lab. /// @@ -355,14 +362,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Delete virtual machine. This operation can take a while to - /// complete. + /// Delete virtual machine. This operation can take a while to complete. /// + /// + /// Delete virtual machine. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -378,14 +385,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Attach a new or existing data disk to virtual machine. This - /// operation can take a while to complete. + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. /// + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// /// /// The name of the lab. /// @@ -393,8 +402,7 @@ public partial interface IVirtualMachinesOperations /// The name of the virtual machine. /// /// - /// Request body for adding a new or existing data disk to a virtual - /// machine. + /// Request body for adding a new or existing data disk to a virtual machine. /// /// /// The headers that will be added to request. @@ -405,14 +413,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginAddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginAddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Apply artifacts to virtual machine. This operation can take a while - /// to complete. + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. /// + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// /// /// The name of the lab. /// @@ -431,14 +441,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Take ownership of an existing virtual machine This operation can - /// take a while to complete. + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. /// + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// /// /// The name of the lab. /// @@ -454,14 +466,16 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginClaimWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginClaimWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Detach the specified disk from the virtual machine. This operation - /// can take a while to complete. + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. /// + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// /// /// The name of the lab. /// @@ -480,14 +494,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Start a virtual machine. This operation can take a while to - /// complete. + /// Start a virtual machine. This operation can take a while to complete. /// + /// + /// Start a virtual machine. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -503,13 +517,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginStartWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginStartWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Stop a virtual machine This operation can take a while to complete. /// + /// + /// Stop a virtual machine This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -525,13 +540,14 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginStopWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginStopWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List virtual machines in a given lab. /// + /// + /// List virtual machines in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -547,9 +563,7 @@ public partial interface IVirtualMachinesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs index aee7a53a1bbe..2eeabdcc2720 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - 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; /// /// VirtualNetworksOperations operations. @@ -27,12 +16,15 @@ public partial interface IVirtualNetworksOperations /// /// List virtual networks in a given lab. /// + /// + /// List virtual networks in a given lab. + /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The headers that will be added to request. /// @@ -45,13 +37,14 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get virtual network. /// + /// + /// Get virtual network. + /// /// /// The name of the lab. /// @@ -59,8 +52,7 @@ public partial interface IVirtualNetworksOperations /// The name of the virtual network. /// /// - /// Specify the $expand query. Example: - /// 'properties($expand=externalSubnets)' + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' /// /// /// The headers that will be added to request. @@ -74,14 +66,16 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing virtual network. This operation can - /// take a while to complete. + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. /// + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// /// /// The name of the lab. /// @@ -103,14 +97,14 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Delete virtual network. This operation can take a while to - /// complete. + /// Delete virtual network. This operation can take a while to complete. /// + /// + /// Delete virtual network. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -126,13 +120,14 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Modify properties of virtual networks. /// + /// + /// Modify properties of virtual networks. + /// /// /// The name of the lab. /// @@ -154,14 +149,16 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string labName, string name, VirtualNetworkFragment virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, VirtualNetworkFragment virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Create or replace an existing virtual network. This operation can - /// take a while to complete. + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. /// + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// /// /// The name of the lab. /// @@ -183,14 +180,14 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Delete virtual network. This operation can take a while to - /// complete. + /// Delete virtual network. This operation can take a while to complete. /// + /// + /// Delete virtual network. This operation can take a while to complete. + /// /// /// The name of the lab. /// @@ -206,13 +203,14 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List virtual networks in a given lab. /// + /// + /// List virtual networks in a given lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -228,9 +226,7 @@ public partial interface IVirtualNetworksOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs index 32fe146c0bad..da98e25c5ec4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// LabsOperations operations. /// - internal partial class LabsOperations : IServiceOperations, ILabsOperations + internal partial class LabsOperations : Microsoft.Rest.IServiceOperations, ILabsOperations { /// /// Initializes a new instance of the LabsOperations class. @@ -37,13 +24,13 @@ internal partial class LabsOperations : IServiceOperations, I /// /// Thrown when a required parameter is null /// - internal LabsOperations(DevTestLabsClient client) + internal LabsOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -55,7 +42,7 @@ internal LabsOperations(DevTestLabsClient client) /// List labs in a subscription. /// /// - /// OData parameters to apply to the operation. + /// /// /// /// Headers that will be added to request. @@ -63,13 +50,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -78,68 +65,78 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _lab = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_lab)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_lab); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -151,55 +148,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -209,9 +207,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -222,30 +221,34 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List labs in a resource group. /// /// - /// OData parameters to apply to the operation. + /// /// /// /// Headers that will be added to request. @@ -253,13 +256,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -268,73 +271,84 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _lab = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_lab)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_lab); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -346,55 +360,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -404,9 +419,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -417,25 +433,29 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get lab. /// @@ -444,7 +464,7 @@ internal LabsOperations(DevTestLabsClient client) /// /// /// Specify the $expand query. Example: - /// 'properties($select=defaultStorageAccount)' + /// 'properties($select=defaultStorageAccount)' /// /// /// Headers that will be added to request. @@ -452,13 +472,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -467,75 +487,87 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -547,55 +579,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -605,9 +638,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -618,25 +652,29 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing lab. This operation can take a while to /// complete. @@ -648,16 +686,16 @@ internal LabsOperations(DevTestLabsClient client) /// A lab. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(name, lab, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(name, lab, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -667,16 +705,16 @@ internal LabsOperations(DevTestLabsClient client) /// The name of the lab. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -694,13 +732,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -709,75 +747,86 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string name, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string name, LabFragment lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (lab == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lab"); } - if (Client.ResourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (lab == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "lab"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + tracingParameters.Add("lab", lab); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -789,61 +838,62 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(lab != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(lab, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(lab, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -853,9 +903,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -866,25 +917,29 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Claim a random claimable virtual machine in the lab. This operation can /// take a while to complete. @@ -893,16 +948,16 @@ internal LabsOperations(DevTestLabsClient client) /// The name of the lab. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task ClaimAnyVmWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task ClaimAnyVmWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginClaimAnyVmWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginClaimAnyVmWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -916,16 +971,16 @@ internal LabsOperations(DevTestLabsClient client) /// Properties for creating a virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task CreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task CreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginCreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -939,16 +994,16 @@ internal LabsOperations(DevTestLabsClient client) /// The parameters of the export operation. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task ExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task ExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -966,13 +1021,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -981,75 +1036,87 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GenerateUploadUriWithHttpMessagesAsync(string name, GenerateUploadUriParameter generateUploadUriParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GenerateUploadUriWithHttpMessagesAsync(string name, GenerateUploadUriParameter generateUploadUriParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (generateUploadUriParameter == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "generateUploadUriParameter"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (generateUploadUriParameter == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "generateUploadUriParameter"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + tracingParameters.Add("generateUploadUriParameter", generateUploadUriParameter); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GenerateUploadUri", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GenerateUploadUri", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1061,61 +1128,62 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(generateUploadUriParameter != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(generateUploadUriParameter, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(generateUploadUriParameter, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1125,9 +1193,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1138,25 +1207,29 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List disk images available for custom image creation. /// @@ -1169,13 +1242,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1184,70 +1257,81 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListVhdsWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListVhdsWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListVhds", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListVhds", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1259,55 +1343,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1317,9 +1402,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1330,25 +1416,29 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing lab. This operation can take a while to /// complete. @@ -1365,13 +1455,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1380,75 +1470,87 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (lab == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lab"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (lab == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "lab"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + tracingParameters.Add("lab", lab); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1460,61 +1562,62 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(lab != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(lab, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(lab, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1524,9 +1627,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1537,16 +1641,16 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -1555,25 +1659,29 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete lab. This operation can take a while to complete. /// @@ -1586,10 +1694,10 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1598,70 +1706,81 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1673,55 +1792,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1731,20 +1851,25 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Claim a random claimable virtual machine in the lab. This operation can /// take a while to complete. @@ -1758,10 +1883,10 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1770,70 +1895,81 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginClaimAnyVmWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginClaimAnyVmWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginClaimAnyVm", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginClaimAnyVm", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1845,55 +1981,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1903,20 +2040,25 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create virtual machines in a lab. This operation can take a while to /// complete. @@ -1933,10 +2075,10 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1945,75 +2087,87 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginCreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginCreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (labVirtualMachineCreationParameter == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labVirtualMachineCreationParameter"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (labVirtualMachineCreationParameter == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labVirtualMachineCreationParameter"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + tracingParameters.Add("labVirtualMachineCreationParameter", labVirtualMachineCreationParameter); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateEnvironment", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateEnvironment", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2025,61 +2179,62 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(labVirtualMachineCreationParameter != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachineCreationParameter, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachineCreationParameter, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2089,20 +2244,25 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Exports the lab resource usage into a storage account This operation can /// take a while to complete. @@ -2119,10 +2279,10 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2131,75 +2291,87 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (exportResourceUsageParameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "exportResourceUsageParameters"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (name == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (exportResourceUsageParameters == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "exportResourceUsageParameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("name", name); + tracingParameters.Add("exportResourceUsageParameters", exportResourceUsageParameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginExportResourceUsage", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExportResourceUsage", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2211,61 +2383,62 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(exportResourceUsageParameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(exportResourceUsageParameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(exportResourceUsageParameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2275,20 +2448,25 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List labs in a subscription. /// @@ -2301,13 +2479,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2316,51 +2494,54 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2372,55 +2553,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2430,9 +2612,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2443,25 +2626,29 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List labs in a resource group. /// @@ -2474,13 +2661,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2489,51 +2676,54 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2545,55 +2735,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2603,9 +2794,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2616,25 +2808,29 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List disk images available for custom image creation. /// @@ -2647,13 +2843,13 @@ internal LabsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2662,51 +2858,54 @@ internal LabsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListVhdsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListVhdsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListVhdsNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListVhdsNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2718,55 +2917,56 @@ internal LabsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2776,9 +2976,10 @@ internal LabsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2789,24 +2990,28 @@ internal LabsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs index 533204a16518..7e686202c0a6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs @@ -1,720 +1,643 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for LabsOperations. + /// Extension methods for LabsOperations /// public static partial class LabsOperationsExtensions { - /// - /// List labs in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListBySubscription(this ILabsOperations operations, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List labs in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this ILabsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List labs in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListByResourceGroup(this ILabsOperations operations, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListByResourceGroupAsync(odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List labs in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this ILabsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($select=defaultStorageAccount)' - /// - public static Lab Get(this ILabsOperations operations, string name, string expand = default(string)) - { - return operations.GetAsync(name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($select=defaultStorageAccount)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ILabsOperations operations, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing lab. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// A lab. - /// - public static Lab CreateOrUpdate(this ILabsOperations operations, string name, Lab lab) - { - return operations.CreateOrUpdateAsync(name, lab).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing lab. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// A lab. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ILabsOperations operations, string name, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete lab. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - public static void Delete(this ILabsOperations operations, string name) - { - operations.DeleteAsync(name).GetAwaiter().GetResult(); - } - - /// - /// Delete lab. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of labs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// A lab. - /// - public static Lab Update(this ILabsOperations operations, string name, LabFragment lab) - { - return operations.UpdateAsync(name, lab).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of labs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// A lab. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ILabsOperations operations, string name, LabFragment lab, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Claim a random claimable virtual machine in the lab. This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - public static void ClaimAnyVm(this ILabsOperations operations, string name) - { - operations.ClaimAnyVmAsync(name).GetAwaiter().GetResult(); - } - - /// - /// Claim a random claimable virtual machine in the lab. This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The cancellation token. - /// - public static async Task ClaimAnyVmAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ClaimAnyVmWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Create virtual machines in a lab. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// Properties for creating a virtual machine. - /// - public static void CreateEnvironment(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) - { - operations.CreateEnvironmentAsync(name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); - } - - /// - /// Create virtual machines in a lab. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// Properties for creating a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task CreateEnvironmentAsync(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.CreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Exports the lab resource usage into a storage account This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The parameters of the export operation. - /// - public static void ExportResourceUsage(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters) - { - operations.ExportResourceUsageAsync(name, exportResourceUsageParameters).GetAwaiter().GetResult(); - } - - /// - /// Exports the lab resource usage into a storage account This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The parameters of the export operation. - /// - /// - /// The cancellation token. - /// - public static async Task ExportResourceUsageAsync(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Generate a URI for uploading custom disk images to a Lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// Properties for generating an upload URI. - /// - public static GenerateUploadUriResponse GenerateUploadUri(this ILabsOperations operations, string name, GenerateUploadUriParameter generateUploadUriParameter) - { - return operations.GenerateUploadUriAsync(name, generateUploadUriParameter).GetAwaiter().GetResult(); - } - - /// - /// Generate a URI for uploading custom disk images to a Lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// Properties for generating an upload URI. - /// - /// - /// The cancellation token. - /// - public static async Task GenerateUploadUriAsync(this ILabsOperations operations, string name, GenerateUploadUriParameter generateUploadUriParameter, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GenerateUploadUriWithHttpMessagesAsync(name, generateUploadUriParameter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List disk images available for custom image creation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - public static IPage ListVhds(this ILabsOperations operations, string name) - { - return operations.ListVhdsAsync(name).GetAwaiter().GetResult(); - } - - /// - /// List disk images available for custom image creation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The cancellation token. - /// - public static async Task> ListVhdsAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListVhdsWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing lab. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// A lab. - /// - public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string name, Lab lab) - { - return operations.BeginCreateOrUpdateAsync(name, lab).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing lab. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// A lab. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this ILabsOperations operations, string name, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete lab. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - public static void BeginDelete(this ILabsOperations operations, string name) - { - operations.BeginDeleteAsync(name).GetAwaiter().GetResult(); - } - - /// - /// Delete lab. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Claim a random claimable virtual machine in the lab. This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - public static void BeginClaimAnyVm(this ILabsOperations operations, string name) - { - operations.BeginClaimAnyVmAsync(name).GetAwaiter().GetResult(); - } - - /// - /// Claim a random claimable virtual machine in the lab. This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The cancellation token. - /// - public static async Task BeginClaimAnyVmAsync(this ILabsOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginClaimAnyVmWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Create virtual machines in a lab. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// Properties for creating a virtual machine. - /// - public static void BeginCreateEnvironment(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) - { - operations.BeginCreateEnvironmentAsync(name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); - } - - /// - /// Create virtual machines in a lab. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// Properties for creating a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateEnvironmentAsync(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginCreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Exports the lab resource usage into a storage account This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The parameters of the export operation. - /// - public static void BeginExportResourceUsage(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters) - { - operations.BeginExportResourceUsageAsync(name, exportResourceUsageParameters).GetAwaiter().GetResult(); - } - - /// - /// Exports the lab resource usage into a storage account This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The parameters of the export operation. - /// - /// - /// The cancellation token. - /// - public static async Task BeginExportResourceUsageAsync(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List labs 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 ILabsOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List labs 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 ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List labs 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 ILabsOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List labs 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 ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List disk images available for custom image creation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListVhdsNext(this ILabsOperations operations, string nextPageLink) - { - return operations.ListVhdsNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List disk images available for custom image creation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListVhdsNextAsync(this ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListVhdsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + /// + /// List labs in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + public static Microsoft.Rest.Azure.IPage ListBySubscription(this ILabsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ILabsOperations)operations).ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List labs in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this ILabsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List labs in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this ILabsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ILabsOperations)operations).ListByResourceGroupAsync(odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List labs in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this ILabsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + public static Lab Get(this ILabsOperations operations, string name, string expand = default(string)) + { + return ((ILabsOperations)operations).GetAsync(name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ILabsOperations operations, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static Lab CreateOrUpdate(this ILabsOperations operations, string name, Lab lab) + { + return ((ILabsOperations)operations).CreateOrUpdateAsync(name, lab).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ILabsOperations operations, string name, Lab lab, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void Delete(this ILabsOperations operations, string name) + { + ((ILabsOperations)operations).DeleteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of labs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static Lab Update(this ILabsOperations operations, string name, LabFragment lab) + { + return ((ILabsOperations)operations).UpdateAsync(name, lab).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of labs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ILabsOperations operations, string name, LabFragment lab, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void ClaimAnyVm(this ILabsOperations operations, string name) + { + ((ILabsOperations)operations).ClaimAnyVmAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ClaimAnyVmAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ClaimAnyVmWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void CreateEnvironment(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) + { + ((ILabsOperations)operations).CreateEnvironmentAsync(name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateEnvironmentAsync(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.CreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void ExportResourceUsage(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters) + { + ((ILabsOperations)operations).ExportResourceUsageAsync(name, exportResourceUsageParameters).GetAwaiter().GetResult(); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ExportResourceUsageAsync(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static GenerateUploadUriResponse GenerateUploadUri(this ILabsOperations operations, string name, GenerateUploadUriParameter generateUploadUriParameter) + { + return ((ILabsOperations)operations).GenerateUploadUriAsync(name, generateUploadUriParameter).GetAwaiter().GetResult(); + } + + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GenerateUploadUriAsync(this ILabsOperations operations, string name, GenerateUploadUriParameter generateUploadUriParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GenerateUploadUriWithHttpMessagesAsync(name, generateUploadUriParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage ListVhds(this ILabsOperations operations, string name) + { + return ((ILabsOperations)operations).ListVhdsAsync(name).GetAwaiter().GetResult(); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListVhdsAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListVhdsWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string name, Lab lab) + { + return ((ILabsOperations)operations).BeginCreateOrUpdateAsync(name, lab).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this ILabsOperations operations, string name, Lab lab, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void BeginDelete(this ILabsOperations operations, string name) + { + ((ILabsOperations)operations).BeginDeleteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void BeginClaimAnyVm(this ILabsOperations operations, string name) + { + ((ILabsOperations)operations).BeginClaimAnyVmAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginClaimAnyVmAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginClaimAnyVmWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void BeginCreateEnvironment(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) + { + ((ILabsOperations)operations).BeginCreateEnvironmentAsync(name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateEnvironmentAsync(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginCreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void BeginExportResourceUsage(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters) + { + ((ILabsOperations)operations).BeginExportResourceUsageAsync(name, exportResourceUsageParameters).GetAwaiter().GetResult(); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginExportResourceUsageAsync(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List labs in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListBySubscriptionNext(this ILabsOperations operations, string nextPageLink) + { + return ((ILabsOperations)operations).ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List labs 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 System.Threading.Tasks.Task> ListBySubscriptionNextAsync(this ILabsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List labs in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this ILabsOperations operations, string nextPageLink) + { + return ((ILabsOperations)operations).ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List labs 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 System.Threading.Tasks.Task> ListByResourceGroupNextAsync(this ILabsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListVhdsNext(this ILabsOperations operations, string nextPageLink) + { + return ((ILabsOperations)operations).ListVhdsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListVhdsNextAsync(this ILabsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListVhdsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs index c8b5d196a75e..fc162126d6cd 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs @@ -1,27 +1,17 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// Schedules applicable to a virtual machine. The schedules may have been /// defined on a VM or on lab level. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class ApplicableSchedule : Resource { /// @@ -35,20 +25,35 @@ public ApplicableSchedule() /// /// Initializes a new instance of the ApplicableSchedule class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The auto-shutdown schedule, if one has - /// been set at the lab or lab resource level. - /// The auto-startup schedule, if one has - /// been set at the lab or lab resource level. - public ApplicableSchedule(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), Schedule labVmsShutdown = default(Schedule), Schedule labVmsStartup = default(Schedule)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The auto-shutdown schedule, if one has been set at the lab or lab resource + /// level. + /// + + /// The auto-startup schedule, if one has been set at the lab or lab resource + /// level. + /// + public ApplicableSchedule(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), Schedule labVmsShutdown = default(Schedule), Schedule labVmsStartup = default(Schedule)) + + : base(id, name, type, location, tags) { - LabVmsShutdown = labVmsShutdown; - LabVmsStartup = labVmsStartup; + this.LabVmsShutdown = labVmsShutdown; + this.LabVmsStartup = labVmsStartup; CustomInit(); } @@ -57,19 +62,19 @@ public ApplicableSchedule() /// partial void CustomInit(); + /// - /// Gets or sets the auto-shutdown schedule, if one has been set at the - /// lab or lab resource level. + /// Gets or sets the auto-shutdown schedule, if one has been set at the lab or + /// lab resource level. /// - [JsonProperty(PropertyName = "properties.labVmsShutdown")] - public Schedule LabVmsShutdown { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVmsShutdown")] + public Schedule LabVmsShutdown {get; set; } /// - /// Gets or sets the auto-startup schedule, if one has been set at the - /// lab or lab resource level. + /// Gets or sets the auto-startup schedule, if one has been set at the lab or + /// lab resource level. /// - [JsonProperty(PropertyName = "properties.labVmsStartup")] - public Schedule LabVmsStartup { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVmsStartup")] + public Schedule LabVmsStartup {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs index 82e9e38194f0..f08c3195525c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs @@ -1,27 +1,17 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// Schedules applicable to a virtual machine. The schedules may have been /// defined on a VM or on lab level. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class ApplicableScheduleFragment : Resource { /// @@ -35,20 +25,35 @@ public ApplicableScheduleFragment() /// /// Initializes a new instance of the ApplicableScheduleFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The auto-shutdown schedule, if one has - /// been set at the lab or lab resource level. - /// The auto-startup schedule, if one has - /// been set at the lab or lab resource level. - public ApplicableScheduleFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ScheduleFragment labVmsShutdown = default(ScheduleFragment), ScheduleFragment labVmsStartup = default(ScheduleFragment)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The auto-shutdown schedule, if one has been set at the lab or lab resource + /// level. + /// + + /// The auto-startup schedule, if one has been set at the lab or lab resource + /// level. + /// + public ApplicableScheduleFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), ScheduleFragment labVmsShutdown = default(ScheduleFragment), ScheduleFragment labVmsStartup = default(ScheduleFragment)) + + : base(id, name, type, location, tags) { - LabVmsShutdown = labVmsShutdown; - LabVmsStartup = labVmsStartup; + this.LabVmsShutdown = labVmsShutdown; + this.LabVmsStartup = labVmsStartup; CustomInit(); } @@ -57,19 +62,19 @@ public ApplicableScheduleFragment() /// partial void CustomInit(); + /// - /// Gets or sets the auto-shutdown schedule, if one has been set at the - /// lab or lab resource level. + /// Gets or sets the auto-shutdown schedule, if one has been set at the lab or + /// lab resource level. /// - [JsonProperty(PropertyName = "properties.labVmsShutdown")] - public ScheduleFragment LabVmsShutdown { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVmsShutdown")] + public ScheduleFragment LabVmsShutdown {get; set; } /// - /// Gets or sets the auto-startup schedule, if one has been set at the - /// lab or lab resource level. + /// Gets or sets the auto-startup schedule, if one has been set at the lab or + /// lab resource level. /// - [JsonProperty(PropertyName = "properties.labVmsStartup")] - public ScheduleFragment LabVmsStartup { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVmsStartup")] + public ScheduleFragment LabVmsStartup {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleProperties.cs new file mode 100644 index 000000000000..95869137b09e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedules applicable to a virtual machine. + /// + public partial class ApplicableScheduleProperties + { + /// + /// Initializes a new instance of the ApplicableScheduleProperties class. + /// + public ApplicableScheduleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicableScheduleProperties class. + /// + + /// The auto-shutdown schedule, if one has been set at the lab or lab resource + /// level. + /// + + /// The auto-startup schedule, if one has been set at the lab or lab resource + /// level. + /// + public ApplicableScheduleProperties(Schedule labVmsShutdown = default(Schedule), Schedule labVmsStartup = default(Schedule)) + + { + this.LabVmsShutdown = labVmsShutdown; + this.LabVmsStartup = labVmsStartup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the auto-shutdown schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmsShutdown")] + public Schedule LabVmsShutdown {get; set; } + + /// + /// Gets or sets the auto-startup schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmsStartup")] + public Schedule LabVmsStartup {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedulePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedulePropertiesFragment.cs new file mode 100644 index 000000000000..3eb2d20041b2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedulePropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedules applicable to a virtual machine. + /// + public partial class ApplicableSchedulePropertiesFragment + { + /// + /// Initializes a new instance of the ApplicableSchedulePropertiesFragment class. + /// + public ApplicableSchedulePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicableSchedulePropertiesFragment class. + /// + + /// The auto-shutdown schedule, if one has been set at the lab or lab resource + /// level. + /// + + /// The auto-startup schedule, if one has been set at the lab or lab resource + /// level. + /// + public ApplicableSchedulePropertiesFragment(ScheduleFragment labVmsShutdown = default(ScheduleFragment), ScheduleFragment labVmsStartup = default(ScheduleFragment)) + + { + this.LabVmsShutdown = labVmsShutdown; + this.LabVmsStartup = labVmsStartup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the auto-shutdown schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmsShutdown")] + public ScheduleFragment LabVmsShutdown {get; set; } + + /// + /// Gets or sets the auto-startup schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmsStartup")] + public ScheduleFragment LabVmsStartup {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs index c82aca03f27c..b57d59b978f2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,10 +23,13 @@ public ApplyArtifactsRequest() /// /// Initializes a new instance of the ApplyArtifactsRequest class. /// - /// The list of artifacts to apply. - public ApplyArtifactsRequest(IList artifacts = default(IList)) + + /// The list of artifacts to apply. + /// + public ApplyArtifactsRequest(System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList)) + { - Artifacts = artifacts; + this.Artifacts = artifacts; CustomInit(); } @@ -43,11 +38,11 @@ public ApplyArtifactsRequest() /// partial void CustomInit(); + /// /// Gets or sets the list of artifacts to apply. /// - [JsonProperty(PropertyName = "artifacts")] - public IList Artifacts { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs index 7afb6ed6171b..f7b48e1c0d75 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// An Azure Resource Manager template. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class ArmTemplate : Resource { /// @@ -34,33 +24,54 @@ public ArmTemplate() /// /// Initializes a new instance of the ArmTemplate class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The display name of the ARM - /// template. - /// The description of the ARM - /// template. - /// The publisher of the ARM template. - /// The URI to the icon of the ARM template. - /// The contents of the ARM template. - /// The creation date of the - /// armTemplate. - /// File name and parameter - /// values information from all azuredeploy.*.parameters.json for the - /// ARM template. - public ArmTemplate(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string displayName = default(string), string description = default(string), string publisher = default(string), string icon = default(string), object contents = default(object), System.DateTime? createdDate = default(System.DateTime?), IList parametersValueFilesInfo = default(IList)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The display name of the ARM template. + /// + + /// The description of the ARM template. + /// + + /// The publisher of the ARM template. + /// + + /// The URI to the icon of the ARM template. + /// + + /// The contents of the ARM template. + /// + + /// The creation date of the armTemplate. + /// + + /// File name and parameter values information from all + /// azuredeploy.*.parameters.json for the ARM template. + /// + public ArmTemplate(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string displayName = default(string), string description = default(string), string publisher = default(string), string icon = default(string), object contents = default(object), System.DateTime? createdDate = default(System.DateTime?), System.Collections.Generic.IList parametersValueFilesInfo = default(System.Collections.Generic.IList)) + + : base(id, name, type, location, tags) { - DisplayName = displayName; - Description = description; - Publisher = publisher; - Icon = icon; - Contents = contents; - CreatedDate = createdDate; - ParametersValueFilesInfo = parametersValueFilesInfo; + this.DisplayName = displayName; + this.Description = description; + this.Publisher = publisher; + this.Icon = icon; + this.Contents = contents; + this.CreatedDate = createdDate; + this.ParametersValueFilesInfo = parametersValueFilesInfo; CustomInit(); } @@ -69,48 +80,48 @@ public ArmTemplate() /// partial void CustomInit(); + /// /// Gets the display name of the ARM template. /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; private set; } /// /// Gets the description of the ARM template. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; private set; } /// /// Gets the publisher of the ARM template. /// - [JsonProperty(PropertyName = "properties.publisher")] - public string Publisher { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.publisher")] + public string Publisher {get; private set; } /// /// Gets the URI to the icon of the ARM template. /// - [JsonProperty(PropertyName = "properties.icon")] - public string Icon { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.icon")] + public string Icon {get; private set; } /// /// Gets the contents of the ARM template. /// - [JsonProperty(PropertyName = "properties.contents")] - public object Contents { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.contents")] + public object Contents {get; private set; } /// /// Gets the creation date of the armTemplate. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets file name and parameter values information from all /// azuredeploy.*.parameters.json for the ARM template. /// - [JsonProperty(PropertyName = "properties.parametersValueFilesInfo")] - public IList ParametersValueFilesInfo { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parametersValueFilesInfo")] + public System.Collections.Generic.IList ParametersValueFilesInfo {get; private set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs index 4ebb200ef3f5..dcd76c3fc811 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,13 +23,17 @@ public ArmTemplateInfo() /// /// Initializes a new instance of the ArmTemplateInfo class. /// - /// The template's contents. - /// The parameters of the ARM - /// template. + + /// The template's contents. + /// + + /// The parameters of the ARM template. + /// public ArmTemplateInfo(object template = default(object), object parameters = default(object)) + { - Template = template; - Parameters = parameters; + this.Template = template; + this.Parameters = parameters; CustomInit(); } @@ -44,17 +42,17 @@ public ArmTemplateInfo() /// partial void CustomInit(); + /// - /// Gets or sets the template's contents. + /// Gets or sets the template's contents. /// - [JsonProperty(PropertyName = "template")] - public object Template { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "template")] + public object Template {get; set; } /// /// Gets or sets the parameters of the ARM template. /// - [JsonProperty(PropertyName = "parameters")] - public object Parameters { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public object Parameters {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs index 90cfd5cb7d46..28d96e8793cd 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ArmTemplateParameterProperties { /// - /// Initializes a new instance of the ArmTemplateParameterProperties - /// class. + /// Initializes a new instance of the ArmTemplateParameterProperties class. /// public ArmTemplateParameterProperties() { @@ -28,15 +21,19 @@ public ArmTemplateParameterProperties() } /// - /// Initializes a new instance of the ArmTemplateParameterProperties - /// class. + /// Initializes a new instance of the ArmTemplateParameterProperties class. /// - /// The name of the template parameter. - /// The value of the template parameter. + + /// The name of the template parameter. + /// + + /// The value of the template parameter. + /// public ArmTemplateParameterProperties(string name = default(string), string value = default(string)) + { - Name = name; - Value = value; + this.Name = name; + this.Value = value; CustomInit(); } @@ -45,17 +42,17 @@ public ArmTemplateParameterProperties() /// partial void CustomInit(); + /// /// Gets or sets the name of the template parameter. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets the value of the template parameter. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateProperties.cs new file mode 100644 index 000000000000..13780a009b2d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an Azure Resource Manager template. + /// + public partial class ArmTemplateProperties + { + /// + /// Initializes a new instance of the ArmTemplateProperties class. + /// + public ArmTemplateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmTemplateProperties class. + /// + + /// The display name of the ARM template. + /// + + /// The description of the ARM template. + /// + + /// The publisher of the ARM template. + /// + + /// The URI to the icon of the ARM template. + /// + + /// The contents of the ARM template. + /// + + /// The creation date of the armTemplate. + /// + + /// File name and parameter values information from all + /// azuredeploy.*.parameters.json for the ARM template. + /// + public ArmTemplateProperties(string displayName = default(string), string description = default(string), string publisher = default(string), string icon = default(string), object contents = default(object), System.DateTime? createdDate = default(System.DateTime?), System.Collections.Generic.IList parametersValueFilesInfo = default(System.Collections.Generic.IList)) + + { + this.DisplayName = displayName; + this.Description = description; + this.Publisher = publisher; + this.Icon = icon; + this.Contents = contents; + this.CreatedDate = createdDate; + this.ParametersValueFilesInfo = parametersValueFilesInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the display name of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the description of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } + + /// + /// Gets the publisher of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; private set; } + + /// + /// Gets the URI to the icon of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "icon")] + public string Icon {get; private set; } + + /// + /// Gets the contents of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "contents")] + public object Contents {get; private set; } + + /// + /// Gets the creation date of the armTemplate. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets file name and parameter values information from all + /// azuredeploy.*.parameters.json for the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parametersValueFilesInfo")] + public System.Collections.Generic.IList ParametersValueFilesInfo {get; private set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs index 348308a7d0f9..32b008c44b96 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// An artifact. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Artifact : Resource { /// @@ -34,30 +24,57 @@ public Artifact() /// /// Initializes a new instance of the Artifact class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The artifact's title. - /// The artifact's description. - /// The artifact's publisher. - /// The file path to the artifact. - /// The URI to the artifact icon. - /// The artifact's target OS. - /// The artifact's parameters. - /// The artifact's creation date. - public Artifact(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string title = default(string), string description = default(string), string publisher = default(string), string filePath = default(string), string icon = default(string), string targetOsType = default(string), object parameters = default(object), System.DateTime? createdDate = default(System.DateTime?)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The artifact's title. + /// + + /// The artifact's description. + /// + + /// The artifact's publisher. + /// + + /// The file path to the artifact. + /// + + /// The URI to the artifact icon. + /// + + /// The artifact's target OS. + /// + + /// The artifact's parameters. + /// + + /// The artifact's creation date. + /// + public Artifact(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string title = default(string), string description = default(string), string publisher = default(string), string filePath = default(string), string icon = default(string), string targetOSType = default(string), object parameters = default(object), System.DateTime? createdDate = default(System.DateTime?)) + + : base(id, name, type, location, tags) { - Title = title; - Description = description; - Publisher = publisher; - FilePath = filePath; - Icon = icon; - TargetOsType = targetOsType; - Parameters = parameters; - CreatedDate = createdDate; + this.Title = title; + this.Description = description; + this.Publisher = publisher; + this.FilePath = filePath; + this.Icon = icon; + this.TargetOSType = targetOSType; + this.Parameters = parameters; + this.CreatedDate = createdDate; CustomInit(); } @@ -66,53 +83,53 @@ public Artifact() /// partial void CustomInit(); + /// - /// Gets the artifact's title. + /// Gets the artifact's title. /// - [JsonProperty(PropertyName = "properties.title")] - public string Title { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.title")] + public string Title {get; private set; } /// - /// Gets the artifact's description. + /// Gets the artifact's description. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; private set; } /// - /// Gets the artifact's publisher. + /// Gets the artifact's publisher. /// - [JsonProperty(PropertyName = "properties.publisher")] - public string Publisher { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.publisher")] + public string Publisher {get; private set; } /// /// Gets the file path to the artifact. /// - [JsonProperty(PropertyName = "properties.filePath")] - public string FilePath { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.filePath")] + public string FilePath {get; private set; } /// /// Gets the URI to the artifact icon. /// - [JsonProperty(PropertyName = "properties.icon")] - public string Icon { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.icon")] + public string Icon {get; private set; } /// - /// Gets the artifact's target OS. + /// Gets the artifact's target OS. /// - [JsonProperty(PropertyName = "properties.targetOsType")] - public string TargetOsType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetOsType")] + public string TargetOSType {get; private set; } /// - /// Gets the artifact's parameters. + /// Gets the artifact's parameters. /// - [JsonProperty(PropertyName = "properties.parameters")] - public object Parameters { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parameters")] + public object Parameters {get; private set; } /// - /// Gets the artifact's creation date. + /// Gets the artifact's creation date. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs index 608decf38634..68376efc98b1 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ArtifactDeploymentStatusProperties { /// - /// Initializes a new instance of the - /// ArtifactDeploymentStatusProperties class. + /// Initializes a new instance of the ArtifactDeploymentStatusProperties class. /// public ArtifactDeploymentStatusProperties() { @@ -28,20 +21,23 @@ public ArtifactDeploymentStatusProperties() } /// - /// Initializes a new instance of the - /// ArtifactDeploymentStatusProperties class. + /// Initializes a new instance of the ArtifactDeploymentStatusProperties class. /// - /// The deployment status of the - /// artifact. - /// The total count of the artifacts - /// that were successfully applied. - /// The total count of the artifacts that - /// were tentatively applied. + + /// The deployment status of the artifact. + /// + + /// The total count of the artifacts that were successfully applied. + /// + + /// The total count of the artifacts that were tentatively applied. + /// public ArtifactDeploymentStatusProperties(string deploymentStatus = default(string), int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) + { - DeploymentStatus = deploymentStatus; - ArtifactsApplied = artifactsApplied; - TotalArtifacts = totalArtifacts; + this.DeploymentStatus = deploymentStatus; + this.ArtifactsApplied = artifactsApplied; + this.TotalArtifacts = totalArtifacts; CustomInit(); } @@ -50,25 +46,25 @@ public ArtifactDeploymentStatusProperties() /// partial void CustomInit(); + /// /// Gets or sets the deployment status of the artifact. /// - [JsonProperty(PropertyName = "deploymentStatus")] - public string DeploymentStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStatus")] + public string DeploymentStatus {get; set; } /// - /// Gets or sets the total count of the artifacts that were - /// successfully applied. + /// Gets or sets the total count of the artifacts that were successfully + /// applied. /// - [JsonProperty(PropertyName = "artifactsApplied")] - public int? ArtifactsApplied { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactsApplied")] + public int? ArtifactsApplied {get; set; } /// /// Gets or sets the total count of the artifacts that were tentatively /// applied. /// - [JsonProperty(PropertyName = "totalArtifacts")] - public int? TotalArtifacts { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "totalArtifacts")] + public int? TotalArtifacts {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs index 6e4e03c72765..240a4ea20ab8 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ArtifactDeploymentStatusPropertiesFragment { /// - /// Initializes a new instance of the - /// ArtifactDeploymentStatusPropertiesFragment class. + /// Initializes a new instance of the ArtifactDeploymentStatusPropertiesFragment class. /// public ArtifactDeploymentStatusPropertiesFragment() { @@ -28,20 +21,23 @@ public ArtifactDeploymentStatusPropertiesFragment() } /// - /// Initializes a new instance of the - /// ArtifactDeploymentStatusPropertiesFragment class. + /// Initializes a new instance of the ArtifactDeploymentStatusPropertiesFragment class. /// - /// The deployment status of the - /// artifact. - /// The total count of the artifacts - /// that were successfully applied. - /// The total count of the artifacts that - /// were tentatively applied. + + /// The deployment status of the artifact. + /// + + /// The total count of the artifacts that were successfully applied. + /// + + /// The total count of the artifacts that were tentatively applied. + /// public ArtifactDeploymentStatusPropertiesFragment(string deploymentStatus = default(string), int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) + { - DeploymentStatus = deploymentStatus; - ArtifactsApplied = artifactsApplied; - TotalArtifacts = totalArtifacts; + this.DeploymentStatus = deploymentStatus; + this.ArtifactsApplied = artifactsApplied; + this.TotalArtifacts = totalArtifacts; CustomInit(); } @@ -50,25 +46,25 @@ public ArtifactDeploymentStatusPropertiesFragment() /// partial void CustomInit(); + /// /// Gets or sets the deployment status of the artifact. /// - [JsonProperty(PropertyName = "deploymentStatus")] - public string DeploymentStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStatus")] + public string DeploymentStatus {get; set; } /// - /// Gets or sets the total count of the artifacts that were - /// successfully applied. + /// Gets or sets the total count of the artifacts that were successfully + /// applied. /// - [JsonProperty(PropertyName = "artifactsApplied")] - public int? ArtifactsApplied { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactsApplied")] + public int? ArtifactsApplied {get; set; } /// /// Gets or sets the total count of the artifacts that were tentatively /// applied. /// - [JsonProperty(PropertyName = "totalArtifacts")] - public int? TotalArtifacts { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "totalArtifacts")] + public int? TotalArtifacts {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs index 549835c1abc1..60f0128c3534 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,23 +23,33 @@ public ArtifactInstallProperties() /// /// Initializes a new instance of the ArtifactInstallProperties class. /// - /// The artifact's identifier. - /// The parameters of the artifact. - /// The status of the artifact. - /// The status message from the - /// deployment. - /// The status message from the - /// virtual machine extension. - /// The time that the artifact starts to - /// install on the virtual machine. - public ArtifactInstallProperties(string artifactId = default(string), IList parameters = default(IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + + /// The artifact's identifier. + /// + + /// The parameters of the artifact. + /// + + /// The status of the artifact. + /// + + /// The status message from the deployment. + /// + + /// The status message from the virtual machine extension. + /// + + /// The time that the artifact starts to install on the virtual machine. + /// + public ArtifactInstallProperties(string artifactId = default(string), System.Collections.Generic.IList parameters = default(System.Collections.Generic.IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + { - ArtifactId = artifactId; - Parameters = parameters; - Status = status; - DeploymentStatusMessage = deploymentStatusMessage; - VmExtensionStatusMessage = vmExtensionStatusMessage; - InstallTime = installTime; + this.ArtifactId = artifactId; + this.Parameters = parameters; + this.Status = status; + this.DeploymentStatusMessage = deploymentStatusMessage; + this.VMExtensionStatusMessage = vmExtensionStatusMessage; + this.InstallTime = installTime; CustomInit(); } @@ -56,42 +58,42 @@ public ArtifactInstallProperties() /// partial void CustomInit(); + /// - /// Gets or sets the artifact's identifier. + /// Gets or sets the artifact's identifier. /// - [JsonProperty(PropertyName = "artifactId")] - public string ArtifactId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactId")] + public string ArtifactId {get; set; } /// /// Gets or sets the parameters of the artifact. /// - [JsonProperty(PropertyName = "parameters")] - public IList Parameters { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IList Parameters {get; set; } /// /// Gets or sets the status of the artifact. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// /// Gets or sets the status message from the deployment. /// - [JsonProperty(PropertyName = "deploymentStatusMessage")] - public string DeploymentStatusMessage { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStatusMessage")] + public string DeploymentStatusMessage {get; set; } /// /// Gets or sets the status message from the virtual machine extension. /// - [JsonProperty(PropertyName = "vmExtensionStatusMessage")] - public string VmExtensionStatusMessage { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "vmExtensionStatusMessage")] + public string VMExtensionStatusMessage {get; set; } /// - /// Gets or sets the time that the artifact starts to install on the - /// virtual machine. + /// Gets or sets the time that the artifact starts to install on the virtual + /// machine. /// - [JsonProperty(PropertyName = "installTime")] - public System.DateTime? InstallTime { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "installTime")] + public System.DateTime? InstallTime {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs index 1ed69b046199..1318fbef13c5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ArtifactInstallPropertiesFragment { /// - /// Initializes a new instance of the ArtifactInstallPropertiesFragment - /// class. + /// Initializes a new instance of the ArtifactInstallPropertiesFragment class. /// public ArtifactInstallPropertiesFragment() { @@ -30,26 +21,35 @@ public ArtifactInstallPropertiesFragment() } /// - /// Initializes a new instance of the ArtifactInstallPropertiesFragment - /// class. + /// Initializes a new instance of the ArtifactInstallPropertiesFragment class. /// - /// The artifact's identifier. - /// The parameters of the artifact. - /// The status of the artifact. - /// The status message from the - /// deployment. - /// The status message from the - /// virtual machine extension. - /// The time that the artifact starts to - /// install on the virtual machine. - public ArtifactInstallPropertiesFragment(string artifactId = default(string), IList parameters = default(IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + + /// The artifact's identifier. + /// + + /// The parameters of the artifact. + /// + + /// The status of the artifact. + /// + + /// The status message from the deployment. + /// + + /// The status message from the virtual machine extension. + /// + + /// The time that the artifact starts to install on the virtual machine. + /// + public ArtifactInstallPropertiesFragment(string artifactId = default(string), System.Collections.Generic.IList parameters = default(System.Collections.Generic.IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + { - ArtifactId = artifactId; - Parameters = parameters; - Status = status; - DeploymentStatusMessage = deploymentStatusMessage; - VmExtensionStatusMessage = vmExtensionStatusMessage; - InstallTime = installTime; + this.ArtifactId = artifactId; + this.Parameters = parameters; + this.Status = status; + this.DeploymentStatusMessage = deploymentStatusMessage; + this.VMExtensionStatusMessage = vmExtensionStatusMessage; + this.InstallTime = installTime; CustomInit(); } @@ -58,42 +58,42 @@ public ArtifactInstallPropertiesFragment() /// partial void CustomInit(); + /// - /// Gets or sets the artifact's identifier. + /// Gets or sets the artifact's identifier. /// - [JsonProperty(PropertyName = "artifactId")] - public string ArtifactId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactId")] + public string ArtifactId {get; set; } /// /// Gets or sets the parameters of the artifact. /// - [JsonProperty(PropertyName = "parameters")] - public IList Parameters { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IList Parameters {get; set; } /// /// Gets or sets the status of the artifact. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// /// Gets or sets the status message from the deployment. /// - [JsonProperty(PropertyName = "deploymentStatusMessage")] - public string DeploymentStatusMessage { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStatusMessage")] + public string DeploymentStatusMessage {get; set; } /// /// Gets or sets the status message from the virtual machine extension. /// - [JsonProperty(PropertyName = "vmExtensionStatusMessage")] - public string VmExtensionStatusMessage { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "vmExtensionStatusMessage")] + public string VMExtensionStatusMessage {get; set; } /// - /// Gets or sets the time that the artifact starts to install on the - /// virtual machine. + /// Gets or sets the time that the artifact starts to install on the virtual + /// machine. /// - [JsonProperty(PropertyName = "installTime")] - public System.DateTime? InstallTime { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "installTime")] + public System.DateTime? InstallTime {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs index 1da54a237f25..97c6907499a8 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ArtifactParameterProperties { /// - /// Initializes a new instance of the ArtifactParameterProperties - /// class. + /// Initializes a new instance of the ArtifactParameterProperties class. /// public ArtifactParameterProperties() { @@ -28,15 +21,19 @@ public ArtifactParameterProperties() } /// - /// Initializes a new instance of the ArtifactParameterProperties - /// class. + /// Initializes a new instance of the ArtifactParameterProperties class. /// - /// The name of the artifact parameter. - /// The value of the artifact parameter. + + /// The name of the artifact parameter. + /// + + /// The value of the artifact parameter. + /// public ArtifactParameterProperties(string name = default(string), string value = default(string)) + { - Name = name; - Value = value; + this.Name = name; + this.Value = value; CustomInit(); } @@ -45,17 +42,17 @@ public ArtifactParameterProperties() /// partial void CustomInit(); + /// /// Gets or sets the name of the artifact parameter. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets the value of the artifact parameter. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs index 991965a21d01..1c959a47396e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ArtifactParameterPropertiesFragment { /// - /// Initializes a new instance of the - /// ArtifactParameterPropertiesFragment class. + /// Initializes a new instance of the ArtifactParameterPropertiesFragment class. /// public ArtifactParameterPropertiesFragment() { @@ -28,15 +21,19 @@ public ArtifactParameterPropertiesFragment() } /// - /// Initializes a new instance of the - /// ArtifactParameterPropertiesFragment class. + /// Initializes a new instance of the ArtifactParameterPropertiesFragment class. /// - /// The name of the artifact parameter. - /// The value of the artifact parameter. + + /// The name of the artifact parameter. + /// + + /// The value of the artifact parameter. + /// public ArtifactParameterPropertiesFragment(string name = default(string), string value = default(string)) + { - Name = name; - Value = value; + this.Name = name; + this.Value = value; CustomInit(); } @@ -45,17 +42,17 @@ public ArtifactParameterPropertiesFragment() /// partial void CustomInit(); + /// /// Gets or sets the name of the artifact parameter. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets the value of the artifact parameter. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactProperties.cs new file mode 100644 index 000000000000..763a9b91784f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact. + /// + public partial class ArtifactProperties + { + /// + /// Initializes a new instance of the ArtifactProperties class. + /// + public ArtifactProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactProperties class. + /// + + /// The artifact's title. + /// + + /// The artifact's description. + /// + + /// The artifact's publisher. + /// + + /// The file path to the artifact. + /// + + /// The URI to the artifact icon. + /// + + /// The artifact's target OS. + /// + + /// The artifact's parameters. + /// + + /// The artifact's creation date. + /// + public ArtifactProperties(string title = default(string), string description = default(string), string publisher = default(string), string filePath = default(string), string icon = default(string), string targetOSType = default(string), object parameters = default(object), System.DateTime? createdDate = default(System.DateTime?)) + + { + this.Title = title; + this.Description = description; + this.Publisher = publisher; + this.FilePath = filePath; + this.Icon = icon; + this.TargetOSType = targetOSType; + this.Parameters = parameters; + this.CreatedDate = createdDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the artifact's title. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "title")] + public string Title {get; private set; } + + /// + /// Gets the artifact's description. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } + + /// + /// Gets the artifact's publisher. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; private set; } + + /// + /// Gets the file path to the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "filePath")] + public string FilePath {get; private set; } + + /// + /// Gets the URI to the artifact icon. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "icon")] + public string Icon {get; private set; } + + /// + /// Gets the artifact's target OS. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetOsType")] + public string TargetOSType {get; private set; } + + /// + /// Gets the artifact's parameters. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public object Parameters {get; private set; } + + /// + /// Gets the artifact's creation date. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs index fc8cc3fe327e..17ee83e3d8a1 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// Properties of an artifact source. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class ArtifactSource : Resource { /// @@ -34,46 +24,69 @@ public ArtifactSource() /// /// Initializes a new instance of the ArtifactSource class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The artifact source's display - /// name. - /// The artifact source's URI. - /// The artifact source's type. Possible - /// values include: 'VsoGit', 'GitHub' - /// The folder containing artifacts. - /// The folder containing Azure - /// Resource Manager templates. - /// The artifact source's branch - /// reference. - /// The security token to authenticate to - /// the artifact source. - /// Indicates if the artifact source is enabled - /// (values: Enabled, Disabled). Possible values include: 'Enabled', - /// 'Disabled' - /// The artifact source's creation - /// date. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public ArtifactSource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The artifact source's display name. + /// + + /// The artifact source's URI. + /// + + /// The artifact source's type. + /// Possible values include: 'VsoGit', 'GitHub' + + /// The folder containing artifacts. + /// + + /// The folder containing Azure Resource Manager templates. + /// + + /// The artifact source's branch reference. + /// + + /// The security token to authenticate to the artifact source. + /// + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + + /// The artifact source's creation date. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ArtifactSource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - DisplayName = displayName; - Uri = uri; - SourceType = sourceType; - FolderPath = folderPath; - ArmTemplateFolderPath = armTemplateFolderPath; - BranchRef = branchRef; - SecurityToken = securityToken; - Status = status; - CreatedDate = createdDate; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.DisplayName = displayName; + this.Uri = uri; + this.SourceType = sourceType; + this.FolderPath = folderPath; + this.ArmTemplateFolderPath = armTemplateFolderPath; + this.BranchRef = branchRef; + this.SecurityToken = securityToken; + this.Status = status; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -82,75 +95,72 @@ public ArtifactSource() /// partial void CustomInit(); + /// - /// Gets or sets the artifact source's display name. + /// Gets or sets the artifact source's display name. /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } /// - /// Gets or sets the artifact source's URI. + /// Gets or sets the artifact source's URI. /// - [JsonProperty(PropertyName = "properties.uri")] - public string Uri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uri")] + public string Uri {get; set; } /// - /// Gets or sets the artifact source's type. Possible values include: - /// 'VsoGit', 'GitHub' + /// Gets or sets the artifact source's type. Possible values include: 'VsoGit', 'GitHub' /// - [JsonProperty(PropertyName = "properties.sourceType")] - public string SourceType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sourceType")] + public string SourceType {get; set; } /// /// Gets or sets the folder containing artifacts. /// - [JsonProperty(PropertyName = "properties.folderPath")] - public string FolderPath { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.folderPath")] + public string FolderPath {get; set; } /// - /// Gets or sets the folder containing Azure Resource Manager - /// templates. + /// Gets or sets the folder containing Azure Resource Manager templates. /// - [JsonProperty(PropertyName = "properties.armTemplateFolderPath")] - public string ArmTemplateFolderPath { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.armTemplateFolderPath")] + public string ArmTemplateFolderPath {get; set; } /// - /// Gets or sets the artifact source's branch reference. + /// Gets or sets the artifact source's branch reference. /// - [JsonProperty(PropertyName = "properties.branchRef")] - public string BranchRef { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.branchRef")] + public string BranchRef {get; set; } /// - /// Gets or sets the security token to authenticate to the artifact - /// source. + /// Gets or sets the security token to authenticate to the artifact source. /// - [JsonProperty(PropertyName = "properties.securityToken")] - public string SecurityToken { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.securityToken")] + public string SecurityToken {get; set; } /// - /// Gets or sets indicates if the artifact source is enabled (values: - /// Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + /// Gets or sets indicates if the artifact source is enabled (values: Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// - /// Gets the artifact source's creation date. + /// Gets the artifact source's creation date. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs index f4b5624edf83..7af813d79430 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// Properties of an artifact source. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class ArtifactSourceFragment : Resource { /// @@ -34,43 +24,65 @@ public ArtifactSourceFragment() /// /// Initializes a new instance of the ArtifactSourceFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The artifact source's display - /// name. - /// The artifact source's URI. - /// The artifact source's type. Possible - /// values include: 'VsoGit', 'GitHub' - /// The folder containing artifacts. - /// The folder containing Azure - /// Resource Manager templates. - /// The artifact source's branch - /// reference. - /// The security token to authenticate to - /// the artifact source. - /// Indicates if the artifact source is enabled - /// (values: Enabled, Disabled). Possible values include: 'Enabled', - /// 'Disabled' - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public ArtifactSourceFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The artifact source's display name. + /// + + /// The artifact source's URI. + /// + + /// The artifact source's type. + /// Possible values include: 'VsoGit', 'GitHub' + + /// The folder containing artifacts. + /// + + /// The folder containing Azure Resource Manager templates. + /// + + /// The artifact source's branch reference. + /// + + /// The security token to authenticate to the artifact source. + /// + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ArtifactSourceFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - DisplayName = displayName; - Uri = uri; - SourceType = sourceType; - FolderPath = folderPath; - ArmTemplateFolderPath = armTemplateFolderPath; - BranchRef = branchRef; - SecurityToken = securityToken; - Status = status; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.DisplayName = displayName; + this.Uri = uri; + this.SourceType = sourceType; + this.FolderPath = folderPath; + this.ArmTemplateFolderPath = armTemplateFolderPath; + this.BranchRef = branchRef; + this.SecurityToken = securityToken; + this.Status = status; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -79,69 +91,66 @@ public ArtifactSourceFragment() /// partial void CustomInit(); + /// - /// Gets or sets the artifact source's display name. + /// Gets or sets the artifact source's display name. /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } /// - /// Gets or sets the artifact source's URI. + /// Gets or sets the artifact source's URI. /// - [JsonProperty(PropertyName = "properties.uri")] - public string Uri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uri")] + public string Uri {get; set; } /// - /// Gets or sets the artifact source's type. Possible values include: - /// 'VsoGit', 'GitHub' + /// Gets or sets the artifact source's type. Possible values include: 'VsoGit', 'GitHub' /// - [JsonProperty(PropertyName = "properties.sourceType")] - public string SourceType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sourceType")] + public string SourceType {get; set; } /// /// Gets or sets the folder containing artifacts. /// - [JsonProperty(PropertyName = "properties.folderPath")] - public string FolderPath { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.folderPath")] + public string FolderPath {get; set; } /// - /// Gets or sets the folder containing Azure Resource Manager - /// templates. + /// Gets or sets the folder containing Azure Resource Manager templates. /// - [JsonProperty(PropertyName = "properties.armTemplateFolderPath")] - public string ArmTemplateFolderPath { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.armTemplateFolderPath")] + public string ArmTemplateFolderPath {get; set; } /// - /// Gets or sets the artifact source's branch reference. + /// Gets or sets the artifact source's branch reference. /// - [JsonProperty(PropertyName = "properties.branchRef")] - public string BranchRef { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.branchRef")] + public string BranchRef {get; set; } /// - /// Gets or sets the security token to authenticate to the artifact - /// source. + /// Gets or sets the security token to authenticate to the artifact source. /// - [JsonProperty(PropertyName = "properties.securityToken")] - public string SecurityToken { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.securityToken")] + public string SecurityToken {get; set; } /// - /// Gets or sets indicates if the artifact source is enabled (values: - /// Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + /// Gets or sets indicates if the artifact source is enabled (values: Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceProperties.cs new file mode 100644 index 000000000000..280e7f305ea8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact source. + /// + public partial class ArtifactSourceProperties + { + /// + /// Initializes a new instance of the ArtifactSourceProperties class. + /// + public ArtifactSourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactSourceProperties class. + /// + + /// The artifact source's display name. + /// + + /// The artifact source's URI. + /// + + /// The artifact source's type. + /// Possible values include: 'VsoGit', 'GitHub' + + /// The folder containing artifacts. + /// + + /// The folder containing Azure Resource Manager templates. + /// + + /// The artifact source's branch reference. + /// + + /// The security token to authenticate to the artifact source. + /// + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + + /// The artifact source's creation date. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ArtifactSourceProperties(string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DisplayName = displayName; + this.Uri = uri; + this.SourceType = sourceType; + this.FolderPath = folderPath; + this.ArmTemplateFolderPath = armTemplateFolderPath; + this.BranchRef = branchRef; + this.SecurityToken = securityToken; + this.Status = status; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the artifact source's display name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the artifact source's URI. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uri")] + public string Uri {get; set; } + + /// + /// Gets or sets the artifact source's type. Possible values include: 'VsoGit', 'GitHub' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sourceType")] + public string SourceType {get; set; } + + /// + /// Gets or sets the folder containing artifacts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "folderPath")] + public string FolderPath {get; set; } + + /// + /// Gets or sets the folder containing Azure Resource Manager templates. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "armTemplateFolderPath")] + public string ArmTemplateFolderPath {get; set; } + + /// + /// Gets or sets the artifact source's branch reference. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "branchRef")] + public string BranchRef {get; set; } + + /// + /// Gets or sets the security token to authenticate to the artifact source. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "securityToken")] + public string SecurityToken {get; set; } + + /// + /// Gets or sets indicates if the artifact source is enabled (values: Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets the artifact source's creation date. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourcePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourcePropertiesFragment.cs new file mode 100644 index 000000000000..50498aad0eeb --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourcePropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact source. + /// + public partial class ArtifactSourcePropertiesFragment + { + /// + /// Initializes a new instance of the ArtifactSourcePropertiesFragment class. + /// + public ArtifactSourcePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactSourcePropertiesFragment class. + /// + + /// The artifact source's display name. + /// + + /// The artifact source's URI. + /// + + /// The artifact source's type. + /// Possible values include: 'VsoGit', 'GitHub' + + /// The folder containing artifacts. + /// + + /// The folder containing Azure Resource Manager templates. + /// + + /// The artifact source's branch reference. + /// + + /// The security token to authenticate to the artifact source. + /// + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ArtifactSourcePropertiesFragment(string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DisplayName = displayName; + this.Uri = uri; + this.SourceType = sourceType; + this.FolderPath = folderPath; + this.ArmTemplateFolderPath = armTemplateFolderPath; + this.BranchRef = branchRef; + this.SecurityToken = securityToken; + this.Status = status; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the artifact source's display name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the artifact source's URI. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uri")] + public string Uri {get; set; } + + /// + /// Gets or sets the artifact source's type. Possible values include: 'VsoGit', 'GitHub' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sourceType")] + public string SourceType {get; set; } + + /// + /// Gets or sets the folder containing artifacts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "folderPath")] + public string FolderPath {get; set; } + + /// + /// Gets or sets the folder containing Azure Resource Manager templates. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "armTemplateFolderPath")] + public string ArmTemplateFolderPath {get; set; } + + /// + /// Gets or sets the artifact source's branch reference. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "branchRef")] + public string BranchRef {get; set; } + + /// + /// Gets or sets the security token to authenticate to the artifact source. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "securityToken")] + public string SecurityToken {get; set; } + + /// + /// Gets or sets indicates if the artifact source is enabled (values: Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs index afc77e65e318..424b6d3ff734 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,13 @@ public AttachDiskProperties() /// /// Initializes a new instance of the AttachDiskProperties class. /// - /// The resource ID of the Lab virtual - /// machine to which the disk is attached. - public AttachDiskProperties(string leasedByLabVmId = default(string)) + + /// The resource ID of the Lab virtual machine to which the disk is attached. + /// + public AttachDiskProperties(string leasedByLabVMId = default(string)) + { - LeasedByLabVmId = leasedByLabVmId; + this.LeasedByLabVMId = leasedByLabVMId; CustomInit(); } @@ -42,12 +38,12 @@ public AttachDiskProperties() /// partial void CustomInit(); + /// - /// Gets or sets the resource ID of the Lab virtual machine to which - /// the disk is attached. + /// Gets or sets the resource ID of the Lab virtual machine to which the disk + /// is attached. /// - [JsonProperty(PropertyName = "leasedByLabVmId")] - public string LeasedByLabVmId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "leasedByLabVmId")] + public string LeasedByLabVMId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs index f2e0d234a8b7..8e866518ee10 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,17 +23,21 @@ public AttachNewDataDiskOptions() /// /// Initializes a new instance of the AttachNewDataDiskOptions class. /// - /// Size of the disk to be attached in - /// GibiBytes. - /// The name of the disk to be attached. - /// The storage type for the disk (i.e. - /// Standard, Premium). Possible values include: 'Standard', - /// 'Premium' + + /// Size of the disk to be attached in GibiBytes. + /// + + /// The name of the disk to be attached. + /// + + /// The storage type for the disk (i.e. Standard, Premium). + /// Possible values include: 'Standard', 'Premium' public AttachNewDataDiskOptions(int? diskSizeGiB = default(int?), string diskName = default(string), string diskType = default(string)) + { - DiskSizeGiB = diskSizeGiB; - DiskName = diskName; - DiskType = diskType; + this.DiskSizeGiB = diskSizeGiB; + this.DiskName = diskName; + this.DiskType = diskType; CustomInit(); } @@ -48,24 +46,23 @@ public AttachNewDataDiskOptions() /// partial void CustomInit(); + /// /// Gets or sets size of the disk to be attached in GibiBytes. /// - [JsonProperty(PropertyName = "diskSizeGiB")] - public int? DiskSizeGiB { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB {get; set; } /// /// Gets or sets the name of the disk to be attached. /// - [JsonProperty(PropertyName = "diskName")] - public string DiskName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "diskName")] + public string DiskName {get; set; } /// - /// Gets or sets the storage type for the disk (i.e. Standard, - /// Premium). Possible values include: 'Standard', 'Premium' + /// Gets or sets the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' /// - [JsonProperty(PropertyName = "diskType")] - public string DiskType { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "diskType")] + public string DiskType {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs index 218660d8d138..bd380ccc14e2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,13 @@ public BulkCreationParameters() /// /// Initializes a new instance of the BulkCreationParameters class. /// - /// The number of virtual machine instances - /// to create. + + /// The number of virtual machine instances to create. + /// public BulkCreationParameters(int? instanceCount = default(int?)) + { - InstanceCount = instanceCount; + this.InstanceCount = instanceCount; CustomInit(); } @@ -42,11 +38,11 @@ public BulkCreationParameters() /// partial void CustomInit(); + /// /// Gets or sets the number of virtual machine instances to create. /// - [JsonProperty(PropertyName = "instanceCount")] - public int? InstanceCount { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "instanceCount")] + public int? InstanceCount {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs index f3f4872ee9e6..a6c0980f526d 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,18 +23,25 @@ public ComputeDataDisk() /// /// Initializes a new instance of the ComputeDataDisk class. /// - /// Gets data disk name. - /// When backed by a blob, the URI of underlying - /// blob. - /// When backed by managed disk, this is - /// the ID of the compute disk resource. - /// Gets data disk size in GiB. + + /// Gets data disk name. + /// + + /// When backed by a blob, the URI of underlying blob. + /// + + /// When backed by managed disk, this is the ID of the compute disk resource. + /// + + /// Gets data disk size in GiB. + /// public ComputeDataDisk(string name = default(string), string diskUri = default(string), string managedDiskId = default(string), int? diskSizeGiB = default(int?)) + { - Name = name; - DiskUri = diskUri; - ManagedDiskId = managedDiskId; - DiskSizeGiB = diskSizeGiB; + this.Name = name; + this.DiskUri = diskUri; + this.ManagedDiskId = managedDiskId; + this.DiskSizeGiB = diskSizeGiB; CustomInit(); } @@ -49,30 +50,30 @@ public ComputeDataDisk() /// partial void CustomInit(); + /// - /// Gets data disk name. + /// Gets or sets gets data disk name. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets when backed by a blob, the URI of underlying blob. /// - [JsonProperty(PropertyName = "diskUri")] - public string DiskUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "diskUri")] + public string DiskUri {get; set; } /// - /// Gets or sets when backed by managed disk, this is the ID of the - /// compute disk resource. + /// Gets or sets when backed by managed disk, this is the ID of the compute + /// disk resource. /// - [JsonProperty(PropertyName = "managedDiskId")] - public string ManagedDiskId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "managedDiskId")] + public string ManagedDiskId {get; set; } /// - /// Gets data disk size in GiB. + /// Gets or sets gets data disk size in GiB. /// - [JsonProperty(PropertyName = "diskSizeGiB")] - public int? DiskSizeGiB { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs index e027e1d58dc1..7ea6f4bbf2f7 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,18 +23,25 @@ public ComputeDataDiskFragment() /// /// Initializes a new instance of the ComputeDataDiskFragment class. /// - /// Gets data disk name. - /// When backed by a blob, the URI of underlying - /// blob. - /// When backed by managed disk, this is - /// the ID of the compute disk resource. - /// Gets data disk size in GiB. + + /// Gets data disk name. + /// + + /// When backed by a blob, the URI of underlying blob. + /// + + /// When backed by managed disk, this is the ID of the compute disk resource. + /// + + /// Gets data disk size in GiB. + /// public ComputeDataDiskFragment(string name = default(string), string diskUri = default(string), string managedDiskId = default(string), int? diskSizeGiB = default(int?)) + { - Name = name; - DiskUri = diskUri; - ManagedDiskId = managedDiskId; - DiskSizeGiB = diskSizeGiB; + this.Name = name; + this.DiskUri = diskUri; + this.ManagedDiskId = managedDiskId; + this.DiskSizeGiB = diskSizeGiB; CustomInit(); } @@ -49,30 +50,30 @@ public ComputeDataDiskFragment() /// partial void CustomInit(); + /// - /// Gets data disk name. + /// Gets or sets gets data disk name. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets when backed by a blob, the URI of underlying blob. /// - [JsonProperty(PropertyName = "diskUri")] - public string DiskUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "diskUri")] + public string DiskUri {get; set; } /// - /// Gets or sets when backed by managed disk, this is the ID of the - /// compute disk resource. + /// Gets or sets when backed by managed disk, this is the ID of the compute + /// disk resource. /// - [JsonProperty(PropertyName = "managedDiskId")] - public string ManagedDiskId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "managedDiskId")] + public string ManagedDiskId {get; set; } /// - /// Gets data disk size in GiB. + /// Gets or sets gets data disk size in GiB. /// - [JsonProperty(PropertyName = "diskSizeGiB")] - public int? DiskSizeGiB { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs index a35d64d423fa..f4245c8e4768 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ComputeVmInstanceViewStatus { /// - /// Initializes a new instance of the ComputeVmInstanceViewStatus - /// class. + /// Initializes a new instance of the ComputeVmInstanceViewStatus class. /// public ComputeVmInstanceViewStatus() { @@ -28,19 +21,23 @@ public ComputeVmInstanceViewStatus() } /// - /// Initializes a new instance of the ComputeVmInstanceViewStatus - /// class. + /// Initializes a new instance of the ComputeVmInstanceViewStatus class. /// - /// Gets the status Code. - /// Gets the short localizable label for - /// the status. - /// Gets the message associated with the - /// status. + + /// Gets the status Code. + /// + + /// Gets the short localizable label for the status. + /// + + /// Gets the message associated with the status. + /// public ComputeVmInstanceViewStatus(string code = default(string), string displayStatus = default(string), string message = default(string)) + { - Code = code; - DisplayStatus = displayStatus; - Message = message; + this.Code = code; + this.DisplayStatus = displayStatus; + this.Message = message; CustomInit(); } @@ -49,23 +46,23 @@ public ComputeVmInstanceViewStatus() /// partial void CustomInit(); + /// - /// Gets the status Code. + /// Gets or sets gets the status Code. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } /// - /// Gets the short localizable label for the status. + /// Gets or sets gets the short localizable label for the status. /// - [JsonProperty(PropertyName = "displayStatus")] - public string DisplayStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus {get; set; } /// - /// Gets the message associated with the status. + /// Gets or sets gets the message associated with the status. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs index bfebdc27f087..c5925c31e413 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ComputeVmInstanceViewStatusFragment { /// - /// Initializes a new instance of the - /// ComputeVmInstanceViewStatusFragment class. + /// Initializes a new instance of the ComputeVmInstanceViewStatusFragment class. /// public ComputeVmInstanceViewStatusFragment() { @@ -28,19 +21,23 @@ public ComputeVmInstanceViewStatusFragment() } /// - /// Initializes a new instance of the - /// ComputeVmInstanceViewStatusFragment class. + /// Initializes a new instance of the ComputeVmInstanceViewStatusFragment class. /// - /// Gets the status Code. - /// Gets the short localizable label for - /// the status. - /// Gets the message associated with the - /// status. + + /// Gets the status Code. + /// + + /// Gets the short localizable label for the status. + /// + + /// Gets the message associated with the status. + /// public ComputeVmInstanceViewStatusFragment(string code = default(string), string displayStatus = default(string), string message = default(string)) + { - Code = code; - DisplayStatus = displayStatus; - Message = message; + this.Code = code; + this.DisplayStatus = displayStatus; + this.Message = message; CustomInit(); } @@ -49,23 +46,23 @@ public ComputeVmInstanceViewStatusFragment() /// partial void CustomInit(); + /// - /// Gets the status Code. + /// Gets or sets gets the status Code. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } /// - /// Gets the short localizable label for the status. + /// Gets or sets gets the short localizable label for the status. /// - [JsonProperty(PropertyName = "displayStatus")] - public string DisplayStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus {get; set; } /// - /// Gets the message associated with the status. + /// Gets or sets gets the message associated with the status. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs index 70ea07a87f87..38d042e5949b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,28 +23,37 @@ public ComputeVmProperties() /// /// Initializes a new instance of the ComputeVmProperties class. /// - /// Gets the statuses of the virtual - /// machine. - /// Gets the OS type of the virtual - /// machine. - /// Gets the size of the virtual machine. - /// Gets the network interface ID of - /// the virtual machine. - /// Gets OS disk blob uri for the virtual - /// machine. - /// Gets data disks blob uri for the virtual - /// machine. - /// Gets all data disks attached to the virtual - /// machine. - public ComputeVmProperties(IList statuses = default(IList), string osType = default(string), string vmSize = default(string), string networkInterfaceId = default(string), string osDiskId = default(string), IList dataDiskIds = default(IList), IList dataDisks = default(IList)) + + /// Gets the statuses of the virtual machine. + /// + + /// Gets the OS type of the virtual machine. + /// + + /// Gets the size of the virtual machine. + /// + + /// Gets the network interface ID of the virtual machine. + /// + + /// Gets OS disk blob uri for the virtual machine. + /// + + /// Gets data disks blob uri for the virtual machine. + /// + + /// Gets all data disks attached to the virtual machine. + /// + public ComputeVmProperties(System.Collections.Generic.IList statuses = default(System.Collections.Generic.IList), string osType = default(string), string vmSize = default(string), string networkInterfaceId = default(string), string osDiskId = default(string), System.Collections.Generic.IList dataDiskIds = default(System.Collections.Generic.IList), System.Collections.Generic.IList dataDisks = default(System.Collections.Generic.IList)) + { - Statuses = statuses; - OsType = osType; - VmSize = vmSize; - NetworkInterfaceId = networkInterfaceId; - OsDiskId = osDiskId; - DataDiskIds = dataDiskIds; - DataDisks = dataDisks; + this.Statuses = statuses; + this.OSType = osType; + this.VMSize = vmSize; + this.NetworkInterfaceId = networkInterfaceId; + this.OSDiskId = osDiskId; + this.DataDiskIds = dataDiskIds; + this.DataDisks = dataDisks; CustomInit(); } @@ -61,47 +62,47 @@ public ComputeVmProperties() /// partial void CustomInit(); + /// - /// Gets the statuses of the virtual machine. + /// Gets or sets gets the statuses of the virtual machine. /// - [JsonProperty(PropertyName = "statuses")] - public IList Statuses { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "statuses")] + public System.Collections.Generic.IList Statuses {get; set; } /// - /// Gets the OS type of the virtual machine. + /// Gets or sets gets the OS type of the virtual machine. /// - [JsonProperty(PropertyName = "osType")] - public string OsType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } /// - /// Gets the size of the virtual machine. + /// Gets or sets gets the size of the virtual machine. /// - [JsonProperty(PropertyName = "vmSize")] - public string VmSize { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "vmSize")] + public string VMSize {get; set; } /// - /// Gets the network interface ID of the virtual machine. + /// Gets or sets gets the network interface ID of the virtual machine. /// - [JsonProperty(PropertyName = "networkInterfaceId")] - public string NetworkInterfaceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterfaceId")] + public string NetworkInterfaceId {get; set; } /// - /// Gets OS disk blob uri for the virtual machine. + /// Gets or sets gets OS disk blob uri for the virtual machine. /// - [JsonProperty(PropertyName = "osDiskId")] - public string OsDiskId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "osDiskId")] + public string OSDiskId {get; set; } /// - /// Gets data disks blob uri for the virtual machine. + /// Gets or sets gets data disks blob uri for the virtual machine. /// - [JsonProperty(PropertyName = "dataDiskIds")] - public IList DataDiskIds { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDiskIds")] + public System.Collections.Generic.IList DataDiskIds {get; set; } /// - /// Gets all data disks attached to the virtual machine. + /// Gets or sets gets all data disks attached to the virtual machine. /// - [JsonProperty(PropertyName = "dataDisks")] - public IList DataDisks { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDisks")] + public System.Collections.Generic.IList DataDisks {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs index 6d1ca72339ed..ed0d26b90a49 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ComputeVmPropertiesFragment { /// - /// Initializes a new instance of the ComputeVmPropertiesFragment - /// class. + /// Initializes a new instance of the ComputeVmPropertiesFragment class. /// public ComputeVmPropertiesFragment() { @@ -30,31 +21,39 @@ public ComputeVmPropertiesFragment() } /// - /// Initializes a new instance of the ComputeVmPropertiesFragment - /// class. + /// Initializes a new instance of the ComputeVmPropertiesFragment class. /// - /// Gets the statuses of the virtual - /// machine. - /// Gets the OS type of the virtual - /// machine. - /// Gets the size of the virtual machine. - /// Gets the network interface ID of - /// the virtual machine. - /// Gets OS disk blob uri for the virtual - /// machine. - /// Gets data disks blob uri for the virtual - /// machine. - /// Gets all data disks attached to the virtual - /// machine. - public ComputeVmPropertiesFragment(IList statuses = default(IList), string osType = default(string), string vmSize = default(string), string networkInterfaceId = default(string), string osDiskId = default(string), IList dataDiskIds = default(IList), IList dataDisks = default(IList)) + + /// Gets the statuses of the virtual machine. + /// + + /// Gets the OS type of the virtual machine. + /// + + /// Gets the size of the virtual machine. + /// + + /// Gets the network interface ID of the virtual machine. + /// + + /// Gets OS disk blob uri for the virtual machine. + /// + + /// Gets data disks blob uri for the virtual machine. + /// + + /// Gets all data disks attached to the virtual machine. + /// + public ComputeVmPropertiesFragment(System.Collections.Generic.IList statuses = default(System.Collections.Generic.IList), string osType = default(string), string vmSize = default(string), string networkInterfaceId = default(string), string osDiskId = default(string), System.Collections.Generic.IList dataDiskIds = default(System.Collections.Generic.IList), System.Collections.Generic.IList dataDisks = default(System.Collections.Generic.IList)) + { - Statuses = statuses; - OsType = osType; - VmSize = vmSize; - NetworkInterfaceId = networkInterfaceId; - OsDiskId = osDiskId; - DataDiskIds = dataDiskIds; - DataDisks = dataDisks; + this.Statuses = statuses; + this.OSType = osType; + this.VMSize = vmSize; + this.NetworkInterfaceId = networkInterfaceId; + this.OSDiskId = osDiskId; + this.DataDiskIds = dataDiskIds; + this.DataDisks = dataDisks; CustomInit(); } @@ -63,47 +62,47 @@ public ComputeVmPropertiesFragment() /// partial void CustomInit(); + /// - /// Gets the statuses of the virtual machine. + /// Gets or sets gets the statuses of the virtual machine. /// - [JsonProperty(PropertyName = "statuses")] - public IList Statuses { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "statuses")] + public System.Collections.Generic.IList Statuses {get; set; } /// - /// Gets the OS type of the virtual machine. + /// Gets or sets gets the OS type of the virtual machine. /// - [JsonProperty(PropertyName = "osType")] - public string OsType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } /// - /// Gets the size of the virtual machine. + /// Gets or sets gets the size of the virtual machine. /// - [JsonProperty(PropertyName = "vmSize")] - public string VmSize { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "vmSize")] + public string VMSize {get; set; } /// - /// Gets the network interface ID of the virtual machine. + /// Gets or sets gets the network interface ID of the virtual machine. /// - [JsonProperty(PropertyName = "networkInterfaceId")] - public string NetworkInterfaceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterfaceId")] + public string NetworkInterfaceId {get; set; } /// - /// Gets OS disk blob uri for the virtual machine. + /// Gets or sets gets OS disk blob uri for the virtual machine. /// - [JsonProperty(PropertyName = "osDiskId")] - public string OsDiskId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "osDiskId")] + public string OSDiskId {get; set; } /// - /// Gets data disks blob uri for the virtual machine. + /// Gets or sets gets data disks blob uri for the virtual machine. /// - [JsonProperty(PropertyName = "dataDiskIds")] - public IList DataDiskIds { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDiskIds")] + public System.Collections.Generic.IList DataDiskIds {get; set; } /// - /// Gets all data disks attached to the virtual machine. + /// Gets or sets gets all data disks attached to the virtual machine. /// - [JsonProperty(PropertyName = "dataDisks")] - public IList DataDisks { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDisks")] + public System.Collections.Generic.IList DataDisks {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs index 7c224fcdc91d..a880fe90b24e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,25 +23,31 @@ public CostThresholdProperties() /// /// Initializes a new instance of the CostThresholdProperties class. /// - /// The ID of the cost threshold - /// item. - /// The value of the percentage cost - /// threshold. - /// Indicates whether this threshold will - /// be displayed on cost charts. Possible values include: 'Enabled', - /// 'Disabled' - /// Indicates whether - /// notifications will be sent when this threshold is exceeded. - /// Possible values include: 'Enabled', 'Disabled' - /// Indicates the datetime when - /// notifications were last sent for this threshold. + + /// The ID of the cost threshold item. + /// + + /// The value of the percentage cost threshold. + /// + + /// Indicates whether this threshold will be displayed on cost charts. + /// Possible values include: 'Enabled', 'Disabled' + + /// Indicates whether notifications will be sent when this threshold is + /// exceeded. + /// Possible values include: 'Enabled', 'Disabled' + + /// Indicates the datetime when notifications were last sent for this + /// threshold. + /// public CostThresholdProperties(string thresholdId = default(string), PercentageCostThresholdProperties percentageThreshold = default(PercentageCostThresholdProperties), string displayOnChart = default(string), string sendNotificationWhenExceeded = default(string), string notificationSent = default(string)) + { - ThresholdId = thresholdId; - PercentageThreshold = percentageThreshold; - DisplayOnChart = displayOnChart; - SendNotificationWhenExceeded = sendNotificationWhenExceeded; - NotificationSent = notificationSent; + this.ThresholdId = thresholdId; + this.PercentageThreshold = percentageThreshold; + this.DisplayOnChart = displayOnChart; + this.SendNotificationWhenExceeded = sendNotificationWhenExceeded; + this.NotificationSent = notificationSent; CustomInit(); } @@ -56,39 +56,38 @@ public CostThresholdProperties() /// partial void CustomInit(); + /// /// Gets or sets the ID of the cost threshold item. /// - [JsonProperty(PropertyName = "thresholdId")] - public string ThresholdId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "thresholdId")] + public string ThresholdId {get; set; } /// /// Gets or sets the value of the percentage cost threshold. /// - [JsonProperty(PropertyName = "percentageThreshold")] - public PercentageCostThresholdProperties PercentageThreshold { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "percentageThreshold")] + public PercentageCostThresholdProperties PercentageThreshold {get; set; } /// - /// Gets or sets indicates whether this threshold will be displayed on - /// cost charts. Possible values include: 'Enabled', 'Disabled' + /// Gets or sets indicates whether this threshold will be displayed on cost + /// charts. Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "displayOnChart")] - public string DisplayOnChart { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "displayOnChart")] + public string DisplayOnChart {get; set; } /// /// Gets or sets indicates whether notifications will be sent when this - /// threshold is exceeded. Possible values include: 'Enabled', - /// 'Disabled' + /// threshold is exceeded. Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "sendNotificationWhenExceeded")] - public string SendNotificationWhenExceeded { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sendNotificationWhenExceeded")] + public string SendNotificationWhenExceeded {get; set; } /// - /// Gets or sets indicates the datetime when notifications were last - /// sent for this threshold. + /// Gets or sets indicates the datetime when notifications were last sent for + /// this threshold. /// - [JsonProperty(PropertyName = "notificationSent")] - public string NotificationSent { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "notificationSent")] + public string NotificationSent {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs index 044427749abb..88da50235131 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for CostThresholdStatus. /// + + public static class CostThresholdStatus { public const string Enabled = "Enabled"; public const string Disabled = "Disabled"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs index 3641c71fbca0..f273e65d08c9 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for CostType. /// + + public static class CostType { public const string Unavailable = "Unavailable"; public const string Reported = "Reported"; public const string Projected = "Projected"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs index a293da2d5257..32f87cddcf74 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A custom image. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class CustomImage : Resource { /// @@ -34,37 +24,57 @@ public CustomImage() /// /// Initializes a new instance of the CustomImage class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The virtual machine from which the image is to be - /// created. - /// The VHD from which the image is to be - /// created. - /// The description of the custom - /// image. - /// The author of the custom image. - /// The creation date of the custom - /// image. - /// The Managed Image Id backing the - /// custom image. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public CustomImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), CustomImagePropertiesFromVm vm = default(CustomImagePropertiesFromVm), CustomImagePropertiesCustom vhd = default(CustomImagePropertiesCustom), string description = default(string), string author = default(string), System.DateTime? creationDate = default(System.DateTime?), string managedImageId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The virtual machine from which the image is to be created. + /// + + /// The VHD from which the image is to be created. + /// + + /// The description of the custom image. + /// + + /// The author of the custom image. + /// + + /// The creation date of the custom image. + /// + + /// The Managed Image Id backing the custom image. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public CustomImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), CustomImagePropertiesFromVm vm = default(CustomImagePropertiesFromVm), CustomImagePropertiesCustom vhd = default(CustomImagePropertiesCustom), string description = default(string), string author = default(string), System.DateTime? creationDate = default(System.DateTime?), string managedImageId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Vm = vm; - Vhd = vhd; - Description = description; - Author = author; - CreationDate = creationDate; - ManagedImageId = managedImageId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.VM = vm; + this.Vhd = vhd; + this.Description = description; + this.Author = author; + this.CreationDate = creationDate; + this.ManagedImageId = managedImageId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -73,67 +83,72 @@ public CustomImage() /// partial void CustomInit(); + /// - /// Gets or sets the virtual machine from which the image is to be - /// created. + /// Gets or sets the virtual machine from which the image is to be created. /// - [JsonProperty(PropertyName = "properties.vm")] - public CustomImagePropertiesFromVm Vm { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vm")] + public CustomImagePropertiesFromVm VM {get; set; } /// /// Gets or sets the VHD from which the image is to be created. /// - [JsonProperty(PropertyName = "properties.vhd")] - public CustomImagePropertiesCustom Vhd { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vhd")] + public CustomImagePropertiesCustom Vhd {get; set; } /// /// Gets or sets the description of the custom image. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// /// Gets or sets the author of the custom image. /// - [JsonProperty(PropertyName = "properties.author")] - public string Author { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.author")] + public string Author {get; set; } /// /// Gets the creation date of the custom image. /// - [JsonProperty(PropertyName = "properties.creationDate")] - public System.DateTime? CreationDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate {get; private set; } /// /// Gets or sets the Managed Image Id backing the custom image. /// - [JsonProperty(PropertyName = "properties.managedImageId")] - public string ManagedImageId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.managedImageId")] + public string ManagedImageId {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Vhd != null) + + if (this.Vhd != null) { - Vhd.Validate(); + this.Vhd.Validate(); } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs index c1ea2b2f2597..0a1b1ebbc090 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for CustomImageOsType. /// + + public static class CustomImageOsType { public const string Windows = "Windows"; public const string Linux = "Linux"; public const string None = "None"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageProperties.cs new file mode 100644 index 000000000000..5c00660dbbfe --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageProperties.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a custom image. + /// + public partial class CustomImageProperties + { + /// + /// Initializes a new instance of the CustomImageProperties class. + /// + public CustomImageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImageProperties class. + /// + + /// The virtual machine from which the image is to be created. + /// + + /// The VHD from which the image is to be created. + /// + + /// The description of the custom image. + /// + + /// The author of the custom image. + /// + + /// The creation date of the custom image. + /// + + /// The Managed Image Id backing the custom image. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public CustomImageProperties(CustomImagePropertiesFromVm vm = default(CustomImagePropertiesFromVm), CustomImagePropertiesCustom vhd = default(CustomImagePropertiesCustom), string description = default(string), string author = default(string), System.DateTime? creationDate = default(System.DateTime?), string managedImageId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.VM = vm; + this.Vhd = vhd; + this.Description = description; + this.Author = author; + this.CreationDate = creationDate; + this.ManagedImageId = managedImageId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the virtual machine from which the image is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vm")] + public CustomImagePropertiesFromVm VM {get; set; } + + /// + /// Gets or sets the VHD from which the image is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vhd")] + public CustomImagePropertiesCustom Vhd {get; set; } + + /// + /// Gets or sets the description of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the author of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "author")] + public string Author {get; set; } + + /// + /// Gets the creation date of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creationDate")] + public System.DateTime? CreationDate {get; private set; } + + /// + /// Gets or sets the Managed Image Id backing the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "managedImageId")] + public string ManagedImageId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.Vhd != null) + { + this.Vhd.Validate(); + } + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs index fe22d2fbf1d7..03af67162266 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Newtonsoft.Json; using System.Linq; /// @@ -20,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class CustomImagePropertiesCustom { /// - /// Initializes a new instance of the CustomImagePropertiesCustom - /// class. + /// Initializes a new instance of the CustomImagePropertiesCustom class. /// public CustomImagePropertiesCustom() { @@ -29,19 +21,23 @@ public CustomImagePropertiesCustom() } /// - /// Initializes a new instance of the CustomImagePropertiesCustom - /// class. + /// Initializes a new instance of the CustomImagePropertiesCustom class. /// - /// The OS type of the custom image (i.e. Windows, - /// Linux). Possible values include: 'Windows', 'Linux', 'None' - /// The image name. - /// Indicates whether sysprep has been run on the - /// VHD. + + /// The image name. + /// + + /// Indicates whether sysprep has been run on the VHD. + /// + + /// The OS type of the custom image (i.e. Windows, Linux) + /// Possible values include: 'Windows', 'Linux', 'None' public CustomImagePropertiesCustom(string osType, string imageName = default(string), bool? sysPrep = default(bool?)) + { - ImageName = imageName; - SysPrep = sysPrep; - OsType = osType; + this.ImageName = imageName; + this.SysPrep = sysPrep; + this.OSType = osType; CustomInit(); } @@ -50,37 +46,38 @@ public CustomImagePropertiesCustom() /// partial void CustomInit(); + /// /// Gets or sets the image name. /// - [JsonProperty(PropertyName = "imageName")] - public string ImageName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "imageName")] + public string ImageName {get; set; } /// /// Gets or sets indicates whether sysprep has been run on the VHD. /// - [JsonProperty(PropertyName = "sysPrep")] - public bool? SysPrep { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sysPrep")] + public bool? SysPrep {get; set; } /// - /// Gets or sets the OS type of the custom image (i.e. Windows, Linux). - /// Possible values include: 'Windows', 'Linux', 'None' + /// Gets or sets the OS type of the custom image (i.e. Windows, Linux) Possible values include: 'Windows', 'Linux', 'None' /// - [JsonProperty(PropertyName = "osType")] - public string OsType { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (OsType == null) + if (this.OSType == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OSType"); } + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs index 08b8fdce4707..88ad7d944fd9 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class CustomImagePropertiesFromVm { /// - /// Initializes a new instance of the CustomImagePropertiesFromVm - /// class. + /// Initializes a new instance of the CustomImagePropertiesFromVm class. /// public CustomImagePropertiesFromVm() { @@ -28,19 +21,23 @@ public CustomImagePropertiesFromVm() } /// - /// Initializes a new instance of the CustomImagePropertiesFromVm - /// class. + /// Initializes a new instance of the CustomImagePropertiesFromVm class. /// - /// The source vm identifier. - /// The Windows OS information of the - /// VM. - /// The Linux OS information of the - /// VM. - public CustomImagePropertiesFromVm(string sourceVmId = default(string), WindowsOsInfo windowsOsInfo = default(WindowsOsInfo), LinuxOsInfo linuxOsInfo = default(LinuxOsInfo)) + + /// The source vm identifier. + /// + + /// The Windows OS information of the VM. + /// + + /// The Linux OS information of the VM. + /// + public CustomImagePropertiesFromVm(string sourceVMId = default(string), WindowsOsInfo windowsOSInfo = default(WindowsOsInfo), LinuxOsInfo linuxOSInfo = default(LinuxOsInfo)) + { - SourceVmId = sourceVmId; - WindowsOsInfo = windowsOsInfo; - LinuxOsInfo = linuxOsInfo; + this.SourceVMId = sourceVMId; + this.WindowsOSInfo = windowsOSInfo; + this.LinuxOSInfo = linuxOSInfo; CustomInit(); } @@ -49,23 +46,23 @@ public CustomImagePropertiesFromVm() /// partial void CustomInit(); + /// /// Gets or sets the source vm identifier. /// - [JsonProperty(PropertyName = "sourceVmId")] - public string SourceVmId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sourceVmId")] + public string SourceVMId {get; set; } /// /// Gets or sets the Windows OS information of the VM. /// - [JsonProperty(PropertyName = "windowsOsInfo")] - public WindowsOsInfo WindowsOsInfo { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "windowsOsInfo")] + public WindowsOsInfo WindowsOSInfo {get; set; } /// /// Gets or sets the Linux OS information of the VM. /// - [JsonProperty(PropertyName = "linuxOsInfo")] - public LinuxOsInfo LinuxOsInfo { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "linuxOsInfo")] + public LinuxOsInfo LinuxOSInfo {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs index 20cb65e6a8dc..d8e88f29be16 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs @@ -1,21 +1,14 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// - /// Request body for adding a new or existing data disk to a virtual - /// machine. + /// Request body for adding a new or existing data disk to a virtual machine. /// public partial class DataDiskProperties { @@ -30,18 +23,21 @@ public DataDiskProperties() /// /// Initializes a new instance of the DataDiskProperties class. /// - /// Specifies options to attach - /// a new disk to the virtual machine. - /// Specifies the existing lab disk id - /// to attach to virtual machine. - /// Caching option for a data disk (i.e. - /// None, ReadOnly, ReadWrite). Possible values include: 'None', - /// 'ReadOnly', 'ReadWrite' + + /// Specifies options to attach a new disk to the virtual machine. + /// + + /// Specifies the existing lab disk id to attach to virtual machine. + /// + + /// Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). + /// Possible values include: 'None', 'ReadOnly', 'ReadWrite' public DataDiskProperties(AttachNewDataDiskOptions attachNewDataDiskOptions = default(AttachNewDataDiskOptions), string existingLabDiskId = default(string), string hostCaching = default(string)) + { - AttachNewDataDiskOptions = attachNewDataDiskOptions; - ExistingLabDiskId = existingLabDiskId; - HostCaching = hostCaching; + this.AttachNewDataDiskOptions = attachNewDataDiskOptions; + this.ExistingLabDiskId = existingLabDiskId; + this.HostCaching = hostCaching; CustomInit(); } @@ -50,27 +46,25 @@ public DataDiskProperties() /// partial void CustomInit(); + /// - /// Gets or sets specifies options to attach a new disk to the virtual - /// machine. + /// Gets or sets specifies options to attach a new disk to the virtual machine. /// - [JsonProperty(PropertyName = "attachNewDataDiskOptions")] - public AttachNewDataDiskOptions AttachNewDataDiskOptions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "attachNewDataDiskOptions")] + public AttachNewDataDiskOptions AttachNewDataDiskOptions {get; set; } /// - /// Gets or sets specifies the existing lab disk id to attach to - /// virtual machine. + /// Gets or sets specifies the existing lab disk id to attach to virtual + /// machine. /// - [JsonProperty(PropertyName = "existingLabDiskId")] - public string ExistingLabDiskId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "existingLabDiskId")] + public string ExistingLabDiskId {get; set; } /// /// Gets or sets caching option for a data disk (i.e. None, ReadOnly, - /// ReadWrite). Possible values include: 'None', 'ReadOnly', - /// 'ReadWrite' + /// ReadWrite). Possible values include: 'None', 'ReadOnly', 'ReadWrite' /// - [JsonProperty(PropertyName = "hostCaching")] - public string HostCaching { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "hostCaching")] + public string HostCaching {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs index 63c3ddbec6d9..ccde19a43693 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,10 +23,13 @@ public DayDetails() /// /// Initializes a new instance of the DayDetails class. /// - /// The time of day the schedule will occur. + + /// The time of day the schedule will occur. + /// public DayDetails(string time = default(string)) + { - Time = time; + this.Time = time; CustomInit(); } @@ -41,11 +38,11 @@ public DayDetails() /// partial void CustomInit(); + /// /// Gets or sets the time of day the schedule will occur. /// - [JsonProperty(PropertyName = "time")] - public string Time { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "time")] + public string Time {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs index 411c0d965773..626bf8068f50 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,10 +23,13 @@ public DayDetailsFragment() /// /// Initializes a new instance of the DayDetailsFragment class. /// - /// The time of day the schedule will occur. + + /// The time of day the schedule will occur. + /// public DayDetailsFragment(string time = default(string)) + { - Time = time; + this.Time = time; CustomInit(); } @@ -41,11 +38,11 @@ public DayDetailsFragment() /// partial void CustomInit(); + /// /// Gets or sets the time of day the schedule will occur. /// - [JsonProperty(PropertyName = "time")] - public string Time { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "time")] + public string Time {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs index 831adf71d768..6a88ef5a2046 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,13 @@ public DetachDataDiskProperties() /// /// Initializes a new instance of the DetachDataDiskProperties class. /// - /// Specifies the disk resource ID to - /// detach from virtual machine. + + /// Specifies the disk resource ID to detach from virtual machine. + /// public DetachDataDiskProperties(string existingLabDiskId = default(string)) + { - ExistingLabDiskId = existingLabDiskId; + this.ExistingLabDiskId = existingLabDiskId; CustomInit(); } @@ -42,12 +38,11 @@ public DetachDataDiskProperties() /// partial void CustomInit(); + /// - /// Gets or sets specifies the disk resource ID to detach from virtual - /// machine. + /// Gets or sets specifies the disk resource ID to detach from virtual machine. /// - [JsonProperty(PropertyName = "existingLabDiskId")] - public string ExistingLabDiskId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "existingLabDiskId")] + public string ExistingLabDiskId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs index 1b7f32948b97..b7e962b8c5e5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,13 @@ public DetachDiskProperties() /// /// Initializes a new instance of the DetachDiskProperties class. /// - /// The resource ID of the Lab VM to - /// which the disk is attached. - public DetachDiskProperties(string leasedByLabVmId = default(string)) + + /// The resource ID of the Lab VM to which the disk is attached. + /// + public DetachDiskProperties(string leasedByLabVMId = default(string)) + { - LeasedByLabVmId = leasedByLabVmId; + this.LeasedByLabVMId = leasedByLabVMId; CustomInit(); } @@ -42,12 +38,11 @@ public DetachDiskProperties() /// partial void CustomInit(); + /// - /// Gets or sets the resource ID of the Lab VM to which the disk is - /// attached. + /// Gets or sets the resource ID of the Lab VM to which the disk is attached. /// - [JsonProperty(PropertyName = "leasedByLabVmId")] - public string LeasedByLabVmId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "leasedByLabVmId")] + public string LeasedByLabVMId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs index 6fdf24337a2e..f10edc0bcf0c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A Disk. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Disk : Resource { /// @@ -34,44 +24,65 @@ public Disk() /// /// Initializes a new instance of the Disk class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The storage type for the disk (i.e. - /// Standard, Premium). Possible values include: 'Standard', - /// 'Premium' - /// The size of the disk in - /// GibiBytes. - /// The resource ID of the VM to which - /// this disk is leased. - /// When backed by a blob, the name of the - /// VHD blob without extension. - /// When backed by a blob, the URI of underlying - /// blob. - /// The creation date of the disk. - /// The host caching policy of the disk (i.e. - /// None, ReadOnly, ReadWrite). - /// When backed by managed disk, this is - /// the ID of the compute disk resource. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public Disk(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string diskType = default(string), int? diskSizeGiB = default(int?), string leasedByLabVmId = default(string), string diskBlobName = default(string), string diskUri = default(string), System.DateTime? createdDate = default(System.DateTime?), string hostCaching = default(string), string managedDiskId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The storage type for the disk (i.e. Standard, Premium). + /// Possible values include: 'Standard', 'Premium' + + /// The size of the disk in GibiBytes. + /// + + /// The resource ID of the VM to which this disk is leased. + /// + + /// When backed by a blob, the name of the VHD blob without extension. + /// + + /// When backed by a blob, the URI of underlying blob. + /// + + /// The creation date of the disk. + /// + + /// The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + /// + + /// When backed by managed disk, this is the ID of the compute disk resource. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Disk(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string diskType = default(string), int? diskSizeGiB = default(int?), string leasedByLabVMId = default(string), string diskBlobName = default(string), string diskUri = default(string), System.DateTime? createdDate = default(System.DateTime?), string hostCaching = default(string), string managedDiskId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - DiskType = diskType; - DiskSizeGiB = diskSizeGiB; - LeasedByLabVmId = leasedByLabVmId; - DiskBlobName = diskBlobName; - DiskUri = diskUri; - CreatedDate = createdDate; - HostCaching = hostCaching; - ManagedDiskId = managedDiskId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.DiskType = diskType; + this.DiskSizeGiB = diskSizeGiB; + this.LeasedByLabVMId = leasedByLabVMId; + this.DiskBlobName = diskBlobName; + this.DiskUri = diskUri; + this.CreatedDate = createdDate; + this.HostCaching = hostCaching; + this.ManagedDiskId = managedDiskId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -80,70 +91,68 @@ public Disk() /// partial void CustomInit(); + /// - /// Gets or sets the storage type for the disk (i.e. Standard, - /// Premium). Possible values include: 'Standard', 'Premium' + /// Gets or sets the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' /// - [JsonProperty(PropertyName = "properties.diskType")] - public string DiskType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.diskType")] + public string DiskType {get; set; } /// /// Gets or sets the size of the disk in GibiBytes. /// - [JsonProperty(PropertyName = "properties.diskSizeGiB")] - public int? DiskSizeGiB { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.diskSizeGiB")] + public int? DiskSizeGiB {get; set; } /// - /// Gets or sets the resource ID of the VM to which this disk is - /// leased. + /// Gets or sets the resource ID of the VM to which this disk is leased. /// - [JsonProperty(PropertyName = "properties.leasedByLabVmId")] - public string LeasedByLabVmId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.leasedByLabVmId")] + public string LeasedByLabVMId {get; set; } /// - /// Gets or sets when backed by a blob, the name of the VHD blob - /// without extension. + /// Gets or sets when backed by a blob, the name of the VHD blob without + /// extension. /// - [JsonProperty(PropertyName = "properties.diskBlobName")] - public string DiskBlobName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.diskBlobName")] + public string DiskBlobName {get; set; } /// /// Gets or sets when backed by a blob, the URI of underlying blob. /// - [JsonProperty(PropertyName = "properties.diskUri")] - public string DiskUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.diskUri")] + public string DiskUri {get; set; } /// /// Gets the creation date of the disk. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// - /// Gets or sets the host caching policy of the disk (i.e. None, - /// ReadOnly, ReadWrite). + /// Gets or sets the host caching policy of the disk (i.e. None, ReadOnly, + /// ReadWrite). /// - [JsonProperty(PropertyName = "properties.hostCaching")] - public string HostCaching { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hostCaching")] + public string HostCaching {get; set; } /// - /// Gets or sets when backed by managed disk, this is the ID of the - /// compute disk resource. + /// Gets or sets when backed by managed disk, this is the ID of the compute + /// disk resource. /// - [JsonProperty(PropertyName = "properties.managedDiskId")] - public string ManagedDiskId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.managedDiskId")] + public string ManagedDiskId {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskProperties.cs new file mode 100644 index 000000000000..2b2a5af4dd25 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a disk. + /// + public partial class DiskProperties + { + /// + /// Initializes a new instance of the DiskProperties class. + /// + public DiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskProperties class. + /// + + /// The storage type for the disk (i.e. Standard, Premium). + /// Possible values include: 'Standard', 'Premium' + + /// The size of the disk in GibiBytes. + /// + + /// The resource ID of the VM to which this disk is leased. + /// + + /// When backed by a blob, the name of the VHD blob without extension. + /// + + /// When backed by a blob, the URI of underlying blob. + /// + + /// The creation date of the disk. + /// + + /// The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + /// + + /// When backed by managed disk, this is the ID of the compute disk resource. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public DiskProperties(string diskType = default(string), int? diskSizeGiB = default(int?), string leasedByLabVMId = default(string), string diskBlobName = default(string), string diskUri = default(string), System.DateTime? createdDate = default(System.DateTime?), string hostCaching = default(string), string managedDiskId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DiskType = diskType; + this.DiskSizeGiB = diskSizeGiB; + this.LeasedByLabVMId = leasedByLabVMId; + this.DiskBlobName = diskBlobName; + this.DiskUri = diskUri; + this.CreatedDate = createdDate; + this.HostCaching = hostCaching; + this.ManagedDiskId = managedDiskId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskType")] + public string DiskType {get; set; } + + /// + /// Gets or sets the size of the disk in GibiBytes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB {get; set; } + + /// + /// Gets or sets the resource ID of the VM to which this disk is leased. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "leasedByLabVmId")] + public string LeasedByLabVMId {get; set; } + + /// + /// Gets or sets when backed by a blob, the name of the VHD blob without + /// extension. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskBlobName")] + public string DiskBlobName {get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskUri")] + public string DiskUri {get; set; } + + /// + /// Gets the creation date of the disk. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the host caching policy of the disk (i.e. None, ReadOnly, + /// ReadWrite). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hostCaching")] + public string HostCaching {get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the compute + /// disk resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "managedDiskId")] + public string ManagedDiskId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs index 5522f701441e..cf3276c72607 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// An environment, which is essentially an ARM template deployment. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class DtlEnvironment : Resource { /// @@ -34,31 +24,51 @@ public DtlEnvironment() /// /// Initializes a new instance of the DtlEnvironment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The deployment properties of the - /// environment. - /// The display name of the Azure - /// Resource Manager template that produced the environment. - /// The identifier of the resource group - /// containing the environment's resources. - /// The creator of the environment. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public DtlEnvironment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), EnvironmentDeploymentProperties deploymentProperties = default(EnvironmentDeploymentProperties), string armTemplateDisplayName = default(string), string resourceGroupId = default(string), string createdByUser = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The deployment properties of the environment. + /// + + /// The display name of the Azure Resource Manager template that produced the + /// environment. + /// + + /// The identifier of the resource group containing the environment's + /// resources. + /// + + /// The creator of the environment. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public DtlEnvironment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), EnvironmentDeploymentProperties deploymentProperties = default(EnvironmentDeploymentProperties), string armTemplateDisplayName = default(string), string resourceGroupId = default(string), string createdByUser = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - DeploymentProperties = deploymentProperties; - ArmTemplateDisplayName = armTemplateDisplayName; - ResourceGroupId = resourceGroupId; - CreatedByUser = createdByUser; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.DeploymentProperties = deploymentProperties; + this.ArmTemplateDisplayName = armTemplateDisplayName; + this.ResourceGroupId = resourceGroupId; + this.CreatedByUser = createdByUser; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -67,43 +77,43 @@ public DtlEnvironment() /// partial void CustomInit(); + /// /// Gets or sets the deployment properties of the environment. /// - [JsonProperty(PropertyName = "properties.deploymentProperties")] - public EnvironmentDeploymentProperties DeploymentProperties { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.deploymentProperties")] + public EnvironmentDeploymentProperties DeploymentProperties {get; set; } /// - /// Gets or sets the display name of the Azure Resource Manager - /// template that produced the environment. + /// Gets or sets the display name of the Azure Resource Manager template that + /// produced the environment. /// - [JsonProperty(PropertyName = "properties.armTemplateDisplayName")] - public string ArmTemplateDisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.armTemplateDisplayName")] + public string ArmTemplateDisplayName {get; set; } /// - /// Gets the identifier of the resource group containing the - /// environment's resources. + /// Gets the identifier of the resource group containing the environment's + /// resources. /// - [JsonProperty(PropertyName = "properties.resourceGroupId")] - public string ResourceGroupId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceGroupId")] + public string ResourceGroupId {get; private set; } /// /// Gets the creator of the environment. /// - [JsonProperty(PropertyName = "properties.createdByUser")] - public string CreatedByUser { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser {get; private set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs index 275695266d64..2cae1466a544 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for EnableStatus. /// + + public static class EnableStatus { public const string Enabled = "Enabled"; public const string Disabled = "Disabled"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs index 7f232051558b..682751389878 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class EnvironmentDeploymentProperties { /// - /// Initializes a new instance of the EnvironmentDeploymentProperties - /// class. + /// Initializes a new instance of the EnvironmentDeploymentProperties class. /// public EnvironmentDeploymentProperties() { @@ -30,17 +21,19 @@ public EnvironmentDeploymentProperties() } /// - /// Initializes a new instance of the EnvironmentDeploymentProperties - /// class. + /// Initializes a new instance of the EnvironmentDeploymentProperties class. /// - /// The Azure Resource Manager template's - /// identifier. - /// The parameters of the Azure Resource - /// Manager template. - public EnvironmentDeploymentProperties(string armTemplateId = default(string), IList parameters = default(IList)) + + /// The Azure Resource Manager template's identifier. + /// + + /// The parameters of the Azure Resource Manager template. + /// + public EnvironmentDeploymentProperties(string armTemplateId = default(string), System.Collections.Generic.IList parameters = default(System.Collections.Generic.IList)) + { - ArmTemplateId = armTemplateId; - Parameters = parameters; + this.ArmTemplateId = armTemplateId; + this.Parameters = parameters; CustomInit(); } @@ -49,17 +42,17 @@ public EnvironmentDeploymentProperties() /// partial void CustomInit(); + /// - /// Gets or sets the Azure Resource Manager template's identifier. + /// Gets or sets the Azure Resource Manager template's identifier. /// - [JsonProperty(PropertyName = "armTemplateId")] - public string ArmTemplateId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "armTemplateId")] + public string ArmTemplateId {get; set; } /// /// Gets or sets the parameters of the Azure Resource Manager template. /// - [JsonProperty(PropertyName = "parameters")] - public IList Parameters { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IList Parameters {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentProperties.cs new file mode 100644 index 000000000000..d5e0093b9fb3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an environment. + /// + public partial class EnvironmentProperties + { + /// + /// Initializes a new instance of the EnvironmentProperties class. + /// + public EnvironmentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentProperties class. + /// + + /// The deployment properties of the environment. + /// + + /// The display name of the Azure Resource Manager template that produced the + /// environment. + /// + + /// The identifier of the resource group containing the environment's + /// resources. + /// + + /// The creator of the environment. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public EnvironmentProperties(EnvironmentDeploymentProperties deploymentProperties = default(EnvironmentDeploymentProperties), string armTemplateDisplayName = default(string), string resourceGroupId = default(string), string createdByUser = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DeploymentProperties = deploymentProperties; + this.ArmTemplateDisplayName = armTemplateDisplayName; + this.ResourceGroupId = resourceGroupId; + this.CreatedByUser = createdByUser; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the deployment properties of the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentProperties")] + public EnvironmentDeploymentProperties DeploymentProperties {get; set; } + + /// + /// Gets or sets the display name of the Azure Resource Manager template that + /// produced the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "armTemplateDisplayName")] + public string ArmTemplateDisplayName {get; set; } + + /// + /// Gets the identifier of the resource group containing the environment's + /// resources. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroupId")] + public string ResourceGroupId {get; private set; } + + /// + /// Gets the creator of the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUser")] + public string CreatedByUser {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs index 5a099faed54a..3bc52cfa91a8 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,21 @@ public EvaluatePoliciesProperties() /// /// Initializes a new instance of the EvaluatePoliciesProperties class. /// - /// The fact name. - /// The fact data. - /// The value offset. + + /// The fact name. + /// + + /// The fact data. + /// + + /// The value offset. + /// public EvaluatePoliciesProperties(string factName = default(string), string factData = default(string), string valueOffset = default(string)) + { - FactName = factName; - FactData = factData; - ValueOffset = valueOffset; + this.FactName = factName; + this.FactData = factData; + this.ValueOffset = valueOffset; CustomInit(); } @@ -45,23 +46,23 @@ public EvaluatePoliciesProperties() /// partial void CustomInit(); + /// /// Gets or sets the fact name. /// - [JsonProperty(PropertyName = "factName")] - public string FactName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "factName")] + public string FactName {get; set; } /// /// Gets or sets the fact data. /// - [JsonProperty(PropertyName = "factData")] - public string FactData { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "factData")] + public string FactData {get; set; } /// /// Gets or sets the value offset. /// - [JsonProperty(PropertyName = "valueOffset")] - public string ValueOffset { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "valueOffset")] + public string ValueOffset {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs index b475886904f8..8ea313544d2a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,10 +23,13 @@ public EvaluatePoliciesRequest() /// /// Initializes a new instance of the EvaluatePoliciesRequest class. /// - /// Policies to evaluate. - public EvaluatePoliciesRequest(IList policies = default(IList)) + + /// Policies to evaluate. + /// + public EvaluatePoliciesRequest(System.Collections.Generic.IList policies = default(System.Collections.Generic.IList)) + { - Policies = policies; + this.Policies = policies; CustomInit(); } @@ -43,11 +38,11 @@ public EvaluatePoliciesRequest() /// partial void CustomInit(); + /// /// Gets or sets policies to evaluate. /// - [JsonProperty(PropertyName = "policies")] - public IList Policies { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "policies")] + public System.Collections.Generic.IList Policies {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs index 2863860ca890..0dbd65f4391f 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,10 +23,13 @@ public EvaluatePoliciesResponse() /// /// Initializes a new instance of the EvaluatePoliciesResponse class. /// - /// Results of evaluating a policy set. - public EvaluatePoliciesResponse(IList results = default(IList)) + + /// Results of evaluating a policy set. + /// + public EvaluatePoliciesResponse(System.Collections.Generic.IList results = default(System.Collections.Generic.IList)) + { - Results = results; + this.Results = results; CustomInit(); } @@ -43,11 +38,11 @@ public EvaluatePoliciesResponse() /// partial void CustomInit(); + /// /// Gets or sets results of evaluating a policy set. /// - [JsonProperty(PropertyName = "results")] - public IList Results { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "results")] + public System.Collections.Generic.IList Results {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs index 70a246af5764..16ceb43dac3e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,14 @@ public EventFragment() /// /// Initializes a new instance of the EventFragment class. /// - /// The event type for which this notification - /// is enabled (i.e. AutoShutdown, Cost). Possible values include: - /// 'AutoShutdown', 'Cost' + + /// The event type for which this notification is enabled (i.e. AutoShutdown, + /// Cost) + /// Possible values include: 'AutoShutdown', 'Cost' public EventFragment(string eventName = default(string)) + { - EventName = eventName; + this.EventName = eventName; CustomInit(); } @@ -43,13 +39,12 @@ public EventFragment() /// partial void CustomInit(); + /// - /// Gets or sets the event type for which this notification is enabled - /// (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', - /// 'Cost' + /// Gets or sets the event type for which this notification is enabled (i.e. + /// AutoShutdown, Cost) Possible values include: 'AutoShutdown', 'Cost' /// - [JsonProperty(PropertyName = "eventName")] - public string EventName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "eventName")] + public string EventName {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs index acbff2cccecf..8d0b18eceb8a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,14 @@ public EventModel() /// /// Initializes a new instance of the EventModel class. /// - /// The event type for which this notification - /// is enabled (i.e. AutoShutdown, Cost). Possible values include: - /// 'AutoShutdown', 'Cost' + + /// The event type for which this notification is enabled (i.e. AutoShutdown, + /// Cost) + /// Possible values include: 'AutoShutdown', 'Cost' public EventModel(string eventName = default(string)) + { - EventName = eventName; + this.EventName = eventName; CustomInit(); } @@ -43,13 +39,12 @@ public EventModel() /// partial void CustomInit(); + /// - /// Gets or sets the event type for which this notification is enabled - /// (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', - /// 'Cost' + /// Gets or sets the event type for which this notification is enabled (i.e. + /// AutoShutdown, Cost) Possible values include: 'AutoShutdown', 'Cost' /// - [JsonProperty(PropertyName = "eventName")] - public string EventName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "eventName")] + public string EventName {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs index 64c01216e84c..4a435cfb7648 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ExportResourceUsageParameters { /// - /// Initializes a new instance of the ExportResourceUsageParameters - /// class. + /// Initializes a new instance of the ExportResourceUsageParameters class. /// public ExportResourceUsageParameters() { @@ -28,19 +21,21 @@ public ExportResourceUsageParameters() } /// - /// Initializes a new instance of the ExportResourceUsageParameters - /// class. + /// Initializes a new instance of the ExportResourceUsageParameters class. /// - /// The blob storage absolute - /// sas uri with write permission to the container which the usage data - /// needs to be uploaded to. - /// The start time of the usage. If not - /// provided, usage will be reported since the beginning of data - /// collection. + + /// The blob storage absolute sas uri with write permission to the container + /// which the usage data needs to be uploaded to. + /// + + /// The start time of the usage. If not provided, usage will be reported since + /// the beginning of data collection. + /// public ExportResourceUsageParameters(string blobStorageAbsoluteSasUri = default(string), System.DateTime? usageStartDate = default(System.DateTime?)) + { - BlobStorageAbsoluteSasUri = blobStorageAbsoluteSasUri; - UsageStartDate = usageStartDate; + this.BlobStorageAbsoluteSasUri = blobStorageAbsoluteSasUri; + this.UsageStartDate = usageStartDate; CustomInit(); } @@ -49,20 +44,19 @@ public ExportResourceUsageParameters() /// partial void CustomInit(); + /// - /// Gets or sets the blob storage absolute sas uri with write - /// permission to the container which the usage data needs to be - /// uploaded to. + /// Gets or sets the blob storage absolute sas uri with write permission to the + /// container which the usage data needs to be uploaded to. /// - [JsonProperty(PropertyName = "blobStorageAbsoluteSasUri")] - public string BlobStorageAbsoluteSasUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "blobStorageAbsoluteSasUri")] + public string BlobStorageAbsoluteSasUri {get; set; } /// - /// Gets or sets the start time of the usage. If not provided, usage - /// will be reported since the beginning of data collection. + /// Gets or sets the start time of the usage. If not provided, usage will be + /// reported since the beginning of data collection. /// - [JsonProperty(PropertyName = "usageStartDate")] - public System.DateTime? UsageStartDate { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "usageStartDate")] + public System.DateTime? UsageStartDate {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs index 1b5d3ba8b0b4..63b833351697 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,17 @@ public ExternalSubnet() /// /// Initializes a new instance of the ExternalSubnet class. /// - /// Gets or sets the identifier. - /// Gets or sets the name. + + /// Gets or sets the identifier. + /// + + /// Gets or sets the name. + /// public ExternalSubnet(string id = default(string), string name = default(string)) + { - Id = id; - Name = name; + this.Id = id; + this.Name = name; CustomInit(); } @@ -43,17 +42,17 @@ public ExternalSubnet() /// partial void CustomInit(); + /// - /// Gets or sets the identifier. + /// Gets or sets gets or sets the identifier. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } /// - /// Gets or sets the name. + /// Gets or sets gets or sets the name. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs index 63b781689d81..f82e7398706b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,17 @@ public ExternalSubnetFragment() /// /// Initializes a new instance of the ExternalSubnetFragment class. /// - /// Gets or sets the identifier. - /// Gets or sets the name. + + /// Gets or sets the identifier. + /// + + /// Gets or sets the name. + /// public ExternalSubnetFragment(string id = default(string), string name = default(string)) + { - Id = id; - Name = name; + this.Id = id; + this.Name = name; CustomInit(); } @@ -43,17 +42,17 @@ public ExternalSubnetFragment() /// partial void CustomInit(); + /// - /// Gets or sets the identifier. + /// Gets or sets gets or sets the identifier. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } /// - /// Gets or sets the name. + /// Gets or sets gets or sets the name. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs index c941785310e8..eeb580ffb8c8 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for FileUploadOptions. /// + + public static class FileUploadOptions { public const string UploadFilesAndGenerateSasTokens = "UploadFilesAndGenerateSasTokens"; public const string None = "None"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs index 6551596f5142..a5a22ca401ef 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs @@ -1,27 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// A formula for creating a VM, specifying an image base and other - /// parameters + /// A formula for creating a VM, specifying an image base and other parameters /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Formula : Resource { /// @@ -35,34 +24,57 @@ public Formula() /// /// Initializes a new instance of the Formula class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The description of the formula. - /// The author of the formula. - /// The OS type of the formula. - /// The creation date of the - /// formula. - /// The content of the formula. - /// Information about a VM from which a formula is to - /// be created. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public Formula(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string description = default(string), string author = default(string), string osType = default(string), System.DateTime? creationDate = default(System.DateTime?), LabVirtualMachineCreationParameter formulaContent = default(LabVirtualMachineCreationParameter), FormulaPropertiesFromVm vm = default(FormulaPropertiesFromVm), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The description of the formula. + /// + + /// The author of the formula. + /// + + /// The OS type of the formula. + /// + + /// The creation date of the formula. + /// + + /// The content of the formula. + /// + + /// Information about a VM from which a formula is to be created. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Formula(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string author = default(string), string osType = default(string), System.DateTime? creationDate = default(System.DateTime?), LabVirtualMachineCreationParameter formulaContent = default(LabVirtualMachineCreationParameter), FormulaPropertiesFromVm vm = default(FormulaPropertiesFromVm), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Description = description; - Author = author; - OsType = osType; - CreationDate = creationDate; - FormulaContent = formulaContent; - Vm = vm; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.Description = description; + this.Author = author; + this.OSType = osType; + this.CreationDate = creationDate; + this.FormulaContent = formulaContent; + this.VM = vm; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -71,54 +83,53 @@ public Formula() /// partial void CustomInit(); + /// /// Gets or sets the description of the formula. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// /// Gets or sets the author of the formula. /// - [JsonProperty(PropertyName = "properties.author")] - public string Author { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.author")] + public string Author {get; set; } /// /// Gets or sets the OS type of the formula. /// - [JsonProperty(PropertyName = "properties.osType")] - public string OsType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.osType")] + public string OSType {get; set; } /// /// Gets the creation date of the formula. /// - [JsonProperty(PropertyName = "properties.creationDate")] - public System.DateTime? CreationDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate {get; private set; } /// /// Gets or sets the content of the formula. /// - [JsonProperty(PropertyName = "properties.formulaContent")] - public LabVirtualMachineCreationParameter FormulaContent { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.formulaContent")] + public LabVirtualMachineCreationParameter FormulaContent {get; set; } /// - /// Gets or sets information about a VM from which a formula is to be - /// created. + /// Gets or sets information about a VM from which a formula is to be created. /// - [JsonProperty(PropertyName = "properties.vm")] - public FormulaPropertiesFromVm Vm { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vm")] + public FormulaPropertiesFromVm VM {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaProperties.cs new file mode 100644 index 000000000000..9ba7caf9ec10 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a formula. + /// + public partial class FormulaProperties + { + /// + /// Initializes a new instance of the FormulaProperties class. + /// + public FormulaProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FormulaProperties class. + /// + + /// The description of the formula. + /// + + /// The author of the formula. + /// + + /// The OS type of the formula. + /// + + /// The creation date of the formula. + /// + + /// The content of the formula. + /// + + /// Information about a VM from which a formula is to be created. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public FormulaProperties(string description = default(string), string author = default(string), string osType = default(string), System.DateTime? creationDate = default(System.DateTime?), LabVirtualMachineCreationParameter formulaContent = default(LabVirtualMachineCreationParameter), FormulaPropertiesFromVm vm = default(FormulaPropertiesFromVm), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Description = description; + this.Author = author; + this.OSType = osType; + this.CreationDate = creationDate; + this.FormulaContent = formulaContent; + this.VM = vm; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the author of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "author")] + public string Author {get; set; } + + /// + /// Gets or sets the OS type of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets the creation date of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creationDate")] + public System.DateTime? CreationDate {get; private set; } + + /// + /// Gets or sets the content of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "formulaContent")] + public LabVirtualMachineCreationParameter FormulaContent {get; set; } + + /// + /// Gets or sets information about a VM from which a formula is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vm")] + public FormulaPropertiesFromVm VM {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs index 8a8484790d4b..5da4ee97675f 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,13 @@ public FormulaPropertiesFromVm() /// /// Initializes a new instance of the FormulaPropertiesFromVm class. /// - /// The identifier of the VM from which a formula - /// is to be created. - public FormulaPropertiesFromVm(string labVmId = default(string)) + + /// The identifier of the VM from which a formula is to be created. + /// + public FormulaPropertiesFromVm(string labVMId = default(string)) + { - LabVmId = labVmId; + this.LabVMId = labVMId; CustomInit(); } @@ -42,12 +38,12 @@ public FormulaPropertiesFromVm() /// partial void CustomInit(); + /// /// Gets or sets the identifier of the VM from which a formula is to be /// created. /// - [JsonProperty(PropertyName = "labVmId")] - public string LabVmId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmId")] + public string LabVMId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs index 6471ae4f7d3b..6c968a486825 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A gallery image. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class GalleryImage : Resource { /// @@ -34,30 +24,49 @@ public GalleryImage() /// /// Initializes a new instance of the GalleryImage class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The author of the gallery image. - /// The creation date of the gallery - /// image. - /// The description of the gallery - /// image. - /// The image reference of the gallery - /// image. - /// The icon of the gallery image. - /// Indicates whether this gallery image is - /// enabled. - public GalleryImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The author of the gallery image. + /// + + /// The creation date of the gallery image. + /// + + /// The description of the gallery image. + /// + + /// The image reference of the gallery image. + /// + + /// The icon of the gallery image. + /// + + /// Indicates whether this gallery image is enabled. + /// + public GalleryImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?)) + + : base(id, name, type, location, tags) { - Author = author; - CreatedDate = createdDate; - Description = description; - ImageReference = imageReference; - Icon = icon; - Enabled = enabled; + this.Author = author; + this.CreatedDate = createdDate; + this.Description = description; + this.ImageReference = imageReference; + this.Icon = icon; + this.Enabled = enabled; CustomInit(); } @@ -66,41 +75,41 @@ public GalleryImage() /// partial void CustomInit(); + /// /// Gets or sets the author of the gallery image. /// - [JsonProperty(PropertyName = "properties.author")] - public string Author { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.author")] + public string Author {get; set; } /// /// Gets the creation date of the gallery image. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets or sets the description of the gallery image. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// /// Gets or sets the image reference of the gallery image. /// - [JsonProperty(PropertyName = "properties.imageReference")] - public GalleryImageReference ImageReference { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.imageReference")] + public GalleryImageReference ImageReference {get; set; } /// /// Gets or sets the icon of the gallery image. /// - [JsonProperty(PropertyName = "properties.icon")] - public string Icon { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.icon")] + public string Icon {get; set; } /// /// Gets or sets indicates whether this gallery image is enabled. /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageProperties.cs new file mode 100644 index 000000000000..f1d163cf1fba --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a gallery image. + /// + public partial class GalleryImageProperties + { + /// + /// Initializes a new instance of the GalleryImageProperties class. + /// + public GalleryImageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageProperties class. + /// + + /// The author of the gallery image. + /// + + /// The creation date of the gallery image. + /// + + /// The description of the gallery image. + /// + + /// The image reference of the gallery image. + /// + + /// The icon of the gallery image. + /// + + /// Indicates whether this gallery image is enabled. + /// + public GalleryImageProperties(string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?)) + + { + this.Author = author; + this.CreatedDate = createdDate; + this.Description = description; + this.ImageReference = imageReference; + this.Icon = icon; + this.Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the author of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "author")] + public string Author {get; set; } + + /// + /// Gets the creation date of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the description of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the image reference of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "imageReference")] + public GalleryImageReference ImageReference {get; set; } + + /// + /// Gets or sets the icon of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "icon")] + public string Icon {get; set; } + + /// + /// Gets or sets indicates whether this gallery image is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + public bool? Enabled {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs index 47b51d16b606..14164edf7fb1 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,18 +23,29 @@ public GalleryImageReference() /// /// Initializes a new instance of the GalleryImageReference class. /// - /// The offer of the gallery image. - /// The publisher of the gallery image. - /// The SKU of the gallery image. - /// The OS type of the gallery image. - /// The version of the gallery image. + + /// The offer of the gallery image. + /// + + /// The publisher of the gallery image. + /// + + /// The SKU of the gallery image. + /// + + /// The OS type of the gallery image. + /// + + /// The version of the gallery image. + /// public GalleryImageReference(string offer = default(string), string publisher = default(string), string sku = default(string), string osType = default(string), string version = default(string)) + { - Offer = offer; - Publisher = publisher; - Sku = sku; - OsType = osType; - Version = version; + this.Offer = offer; + this.Publisher = publisher; + this.Sku = sku; + this.OSType = osType; + this.Version = version; CustomInit(); } @@ -49,35 +54,35 @@ public GalleryImageReference() /// partial void CustomInit(); + /// /// Gets or sets the offer of the gallery image. /// - [JsonProperty(PropertyName = "offer")] - public string Offer { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "offer")] + public string Offer {get; set; } /// /// Gets or sets the publisher of the gallery image. /// - [JsonProperty(PropertyName = "publisher")] - public string Publisher { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; set; } /// /// Gets or sets the SKU of the gallery image. /// - [JsonProperty(PropertyName = "sku")] - public string Sku { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public string Sku {get; set; } /// /// Gets or sets the OS type of the gallery image. /// - [JsonProperty(PropertyName = "osType")] - public string OsType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } /// /// Gets or sets the version of the gallery image. /// - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "version")] + public string Version {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs index 690ad674a0bd..08c01b2b9df5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class GalleryImageReferenceFragment { /// - /// Initializes a new instance of the GalleryImageReferenceFragment - /// class. + /// Initializes a new instance of the GalleryImageReferenceFragment class. /// public GalleryImageReferenceFragment() { @@ -28,21 +21,31 @@ public GalleryImageReferenceFragment() } /// - /// Initializes a new instance of the GalleryImageReferenceFragment - /// class. + /// Initializes a new instance of the GalleryImageReferenceFragment class. /// - /// The offer of the gallery image. - /// The publisher of the gallery image. - /// The SKU of the gallery image. - /// The OS type of the gallery image. - /// The version of the gallery image. + + /// The offer of the gallery image. + /// + + /// The publisher of the gallery image. + /// + + /// The SKU of the gallery image. + /// + + /// The OS type of the gallery image. + /// + + /// The version of the gallery image. + /// public GalleryImageReferenceFragment(string offer = default(string), string publisher = default(string), string sku = default(string), string osType = default(string), string version = default(string)) + { - Offer = offer; - Publisher = publisher; - Sku = sku; - OsType = osType; - Version = version; + this.Offer = offer; + this.Publisher = publisher; + this.Sku = sku; + this.OSType = osType; + this.Version = version; CustomInit(); } @@ -51,35 +54,35 @@ public GalleryImageReferenceFragment() /// partial void CustomInit(); + /// /// Gets or sets the offer of the gallery image. /// - [JsonProperty(PropertyName = "offer")] - public string Offer { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "offer")] + public string Offer {get; set; } /// /// Gets or sets the publisher of the gallery image. /// - [JsonProperty(PropertyName = "publisher")] - public string Publisher { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; set; } /// /// Gets or sets the SKU of the gallery image. /// - [JsonProperty(PropertyName = "sku")] - public string Sku { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public string Sku {get; set; } /// /// Gets or sets the OS type of the gallery image. /// - [JsonProperty(PropertyName = "osType")] - public string OsType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } /// /// Gets or sets the version of the gallery image. /// - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "version")] + public string Version {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs index 0bea30d10a71..ce8eb6882bd9 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,21 +23,26 @@ public GenerateArmTemplateRequest() /// /// Initializes a new instance of the GenerateArmTemplateRequest class. /// - /// The resource name of the virtual - /// machine. - /// The parameters of the ARM - /// template. - /// The location of the virtual machine. - /// Options for uploading the files for - /// the artifact. UploadFilesAndGenerateSasTokens is the default value. - /// Possible values include: 'UploadFilesAndGenerateSasTokens', - /// 'None' - public GenerateArmTemplateRequest(string virtualMachineName = default(string), IList parameters = default(IList), string location = default(string), string fileUploadOptions = default(string)) + + /// The resource name of the virtual machine. + /// + + /// The parameters of the ARM template. + /// + + /// The location of the virtual machine. + /// + + /// Options for uploading the files for the artifact. + /// UploadFilesAndGenerateSasTokens is the default value. + /// Possible values include: 'UploadFilesAndGenerateSasTokens', 'None' + public GenerateArmTemplateRequest(string virtualMachineName = default(string), System.Collections.Generic.IList parameters = default(System.Collections.Generic.IList), string location = default(string), string fileUploadOptions = default(string)) + { - VirtualMachineName = virtualMachineName; - Parameters = parameters; - Location = location; - FileUploadOptions = fileUploadOptions; + this.VirtualMachineName = virtualMachineName; + this.Parameters = parameters; + this.Location = location; + this.FileUploadOptions = fileUploadOptions; CustomInit(); } @@ -54,31 +51,30 @@ public GenerateArmTemplateRequest() /// partial void CustomInit(); + /// /// Gets or sets the resource name of the virtual machine. /// - [JsonProperty(PropertyName = "virtualMachineName")] - public string VirtualMachineName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineName")] + public string VirtualMachineName {get; set; } /// /// Gets or sets the parameters of the ARM template. /// - [JsonProperty(PropertyName = "parameters")] - public IList Parameters { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IList Parameters {get; set; } /// /// Gets or sets the location of the virtual machine. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } /// /// Gets or sets options for uploading the files for the artifact. - /// UploadFilesAndGenerateSasTokens is the default value. Possible - /// values include: 'UploadFilesAndGenerateSasTokens', 'None' + /// UploadFilesAndGenerateSasTokens is the default value. Possible values include: 'UploadFilesAndGenerateSasTokens', 'None' /// - [JsonProperty(PropertyName = "fileUploadOptions")] - public string FileUploadOptions { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "fileUploadOptions")] + public string FileUploadOptions {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs index d3aed3c1cd5a..fb83c2a22a5a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,10 +23,13 @@ public GenerateUploadUriParameter() /// /// Initializes a new instance of the GenerateUploadUriParameter class. /// - /// The blob name of the upload URI. + + /// The blob name of the upload URI. + /// public GenerateUploadUriParameter(string blobName = default(string)) + { - BlobName = blobName; + this.BlobName = blobName; CustomInit(); } @@ -41,11 +38,11 @@ public GenerateUploadUriParameter() /// partial void CustomInit(); + /// /// Gets or sets the blob name of the upload URI. /// - [JsonProperty(PropertyName = "blobName")] - public string BlobName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "blobName")] + public string BlobName {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs index 89138998bb1f..5109bd4e1886 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,10 +23,13 @@ public GenerateUploadUriResponse() /// /// Initializes a new instance of the GenerateUploadUriResponse class. /// - /// The upload URI for the VHD. + + /// The upload URI for the VHD. + /// public GenerateUploadUriResponse(string uploadUri = default(string)) + { - UploadUri = uploadUri; + this.UploadUri = uploadUri; CustomInit(); } @@ -41,11 +38,11 @@ public GenerateUploadUriResponse() /// partial void CustomInit(); + /// /// Gets or sets the upload URI for the VHD. /// - [JsonProperty(PropertyName = "uploadUri")] - public string UploadUri { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "uploadUri")] + public string UploadUri {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs index 912a3ae969bb..5056bcc0e92c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for HostCachingOptions. /// + + public static class HostCachingOptions { public const string None = "None"; public const string ReadOnly = "ReadOnly"; public const string ReadWrite = "ReadWrite"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs index 46baab3647c3..91ade0103cc1 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,13 @@ public HourDetails() /// /// Initializes a new instance of the HourDetails class. /// - /// Minutes of the hour the schedule will - /// run. + + /// Minutes of the hour the schedule will run. + /// public HourDetails(int? minute = default(int?)) + { - Minute = minute; + this.Minute = minute; CustomInit(); } @@ -42,11 +38,11 @@ public HourDetails() /// partial void CustomInit(); + /// /// Gets or sets minutes of the hour the schedule will run. /// - [JsonProperty(PropertyName = "minute")] - public int? Minute { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "minute")] + public int? Minute {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs index 9abc4c1f633f..3e684d8b0bc1 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,13 @@ public HourDetailsFragment() /// /// Initializes a new instance of the HourDetailsFragment class. /// - /// Minutes of the hour the schedule will - /// run. + + /// Minutes of the hour the schedule will run. + /// public HourDetailsFragment(int? minute = default(int?)) + { - Minute = minute; + this.Minute = minute; CustomInit(); } @@ -42,11 +38,11 @@ public HourDetailsFragment() /// partial void CustomInit(); + /// /// Gets or sets minutes of the hour the schedule will run. /// - [JsonProperty(PropertyName = "minute")] - public int? Minute { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "minute")] + public int? Minute {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs index ae65a3ee7c89..1e678a311415 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for HttpStatusCode. /// + + public static class HttpStatusCode { public const string Continue = "Continue"; @@ -59,4 +56,4 @@ public static class HttpStatusCode public const string GatewayTimeout = "GatewayTimeout"; public const string HttpVersionNotSupported = "HttpVersionNotSupported"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs index 852db48b0e93..0c58fae2b8ce 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,18 +23,25 @@ public IdentityProperties() /// /// Initializes a new instance of the IdentityProperties class. /// - /// Managed identity. - /// The principal id of resource - /// identity. - /// The tenant identifier of resource. - /// The client secret URL of the - /// identity. + + /// Managed identity. + /// + + /// The principal id of resource identity. + /// + + /// The tenant identifier of resource. + /// + + /// The client secret URL of the identity. + /// public IdentityProperties(string type = default(string), string principalId = default(string), string tenantId = default(string), string clientSecretUrl = default(string)) + { - Type = type; - PrincipalId = principalId; - TenantId = tenantId; - ClientSecretUrl = clientSecretUrl; + this.Type = type; + this.PrincipalId = principalId; + this.TenantId = tenantId; + this.ClientSecretUrl = clientSecretUrl; CustomInit(); } @@ -49,29 +50,29 @@ public IdentityProperties() /// partial void CustomInit(); + /// /// Gets or sets managed identity. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } /// /// Gets or sets the principal id of resource identity. /// - [JsonProperty(PropertyName = "principalId")] - public string PrincipalId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } /// /// Gets or sets the tenant identifier of resource. /// - [JsonProperty(PropertyName = "tenantId")] - public string TenantId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; set; } /// /// Gets or sets the client secret URL of the identity. /// - [JsonProperty(PropertyName = "clientSecretUrl")] - public string ClientSecretUrl { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "clientSecretUrl")] + public string ClientSecretUrl {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs index 8c840c7bf05a..d5dcf179da08 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs @@ -1,20 +1,14 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// - /// A rule for NAT - exposing a VM's port (backendPort) on the public IP + /// A rule for NAT - exposing a VM's port (backendPort) on the public IP /// address using a load balancer. /// public partial class InboundNatRule @@ -30,19 +24,23 @@ public InboundNatRule() /// /// Initializes a new instance of the InboundNatRule class. /// - /// The transport protocol for the - /// endpoint. Possible values include: 'Tcp', 'Udp' - /// The external endpoint port of the - /// inbound connection. Possible values range between 1 and 65535, - /// inclusive. If unspecified, a value will be allocated - /// automatically. - /// The port to which the external traffic - /// will be redirected. + + /// The transport protocol for the endpoint. + /// Possible values include: 'Tcp', 'Udp' + + /// The external endpoint port of the inbound connection. Possible values range + /// between 1 and 65535, inclusive. If unspecified, a value will be allocated + /// automatically. + /// + + /// The port to which the external traffic will be redirected. + /// public InboundNatRule(string transportProtocol = default(string), int? frontendPort = default(int?), int? backendPort = default(int?)) + { - TransportProtocol = transportProtocol; - FrontendPort = frontendPort; - BackendPort = backendPort; + this.TransportProtocol = transportProtocol; + this.FrontendPort = frontendPort; + this.BackendPort = backendPort; CustomInit(); } @@ -51,27 +49,25 @@ public InboundNatRule() /// partial void CustomInit(); + /// - /// Gets or sets the transport protocol for the endpoint. Possible - /// values include: 'Tcp', 'Udp' + /// Gets or sets the transport protocol for the endpoint. Possible values include: 'Tcp', 'Udp' /// - [JsonProperty(PropertyName = "transportProtocol")] - public string TransportProtocol { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol {get; set; } /// - /// Gets or sets the external endpoint port of the inbound connection. - /// Possible values range between 1 and 65535, inclusive. If - /// unspecified, a value will be allocated automatically. + /// Gets or sets the external endpoint port of the inbound connection. Possible + /// values range between 1 and 65535, inclusive. If unspecified, a value will + /// be allocated automatically. /// - [JsonProperty(PropertyName = "frontendPort")] - public int? FrontendPort { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "frontendPort")] + public int? FrontendPort {get; set; } /// - /// Gets or sets the port to which the external traffic will be - /// redirected. + /// Gets or sets the port to which the external traffic will be redirected. /// - [JsonProperty(PropertyName = "backendPort")] - public int? BackendPort { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int? BackendPort {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs index eed034717d84..830ae26c6ce0 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs @@ -1,20 +1,14 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// - /// A rule for NAT - exposing a VM's port (backendPort) on the public IP + /// A rule for NAT - exposing a VM's port (backendPort) on the public IP /// address using a load balancer. /// public partial class InboundNatRuleFragment @@ -30,19 +24,23 @@ public InboundNatRuleFragment() /// /// Initializes a new instance of the InboundNatRuleFragment class. /// - /// The transport protocol for the - /// endpoint. Possible values include: 'Tcp', 'Udp' - /// The external endpoint port of the - /// inbound connection. Possible values range between 1 and 65535, - /// inclusive. If unspecified, a value will be allocated - /// automatically. - /// The port to which the external traffic - /// will be redirected. + + /// The transport protocol for the endpoint. + /// Possible values include: 'Tcp', 'Udp' + + /// The external endpoint port of the inbound connection. Possible values range + /// between 1 and 65535, inclusive. If unspecified, a value will be allocated + /// automatically. + /// + + /// The port to which the external traffic will be redirected. + /// public InboundNatRuleFragment(string transportProtocol = default(string), int? frontendPort = default(int?), int? backendPort = default(int?)) + { - TransportProtocol = transportProtocol; - FrontendPort = frontendPort; - BackendPort = backendPort; + this.TransportProtocol = transportProtocol; + this.FrontendPort = frontendPort; + this.BackendPort = backendPort; CustomInit(); } @@ -51,27 +49,25 @@ public InboundNatRuleFragment() /// partial void CustomInit(); + /// - /// Gets or sets the transport protocol for the endpoint. Possible - /// values include: 'Tcp', 'Udp' + /// Gets or sets the transport protocol for the endpoint. Possible values include: 'Tcp', 'Udp' /// - [JsonProperty(PropertyName = "transportProtocol")] - public string TransportProtocol { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol {get; set; } /// - /// Gets or sets the external endpoint port of the inbound connection. - /// Possible values range between 1 and 65535, inclusive. If - /// unspecified, a value will be allocated automatically. + /// Gets or sets the external endpoint port of the inbound connection. Possible + /// values range between 1 and 65535, inclusive. If unspecified, a value will + /// be allocated automatically. /// - [JsonProperty(PropertyName = "frontendPort")] - public int? FrontendPort { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "frontendPort")] + public int? FrontendPort {get; set; } /// - /// Gets or sets the port to which the external traffic will be - /// redirected. + /// Gets or sets the port to which the external traffic will be redirected. /// - [JsonProperty(PropertyName = "backendPort")] - public int? BackendPort { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int? BackendPort {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs index bf9767e4c2e7..f82bc16acfa3 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A lab. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Lab : Resource { /// @@ -34,47 +24,70 @@ public Lab() /// /// Initializes a new instance of the Lab class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The lab's default storage - /// account. - /// The lab's default - /// premium storage account. - /// The lab's artifact storage - /// account. - /// The lab's premium data - /// disk storage account. - /// The lab's Key vault. - /// Type of storage used by the lab. It - /// can be either Premium or Standard. Default is Premium. Possible - /// values include: 'Standard', 'Premium' - /// The creation date of the lab. - /// The setting to enable usage of - /// premium data disks. - /// When its value is 'Enabled', creation of standard or premium data - /// disks is allowed. - /// When its value is 'Disabled', only creation of standard data disks - /// is allowed. Possible values include: 'Disabled', 'Enabled' - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public Lab(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string defaultStorageAccount = default(string), string defaultPremiumStorageAccount = default(string), string artifactsStorageAccount = default(string), string premiumDataDiskStorageAccount = default(string), string vaultName = default(string), string labStorageType = default(string), System.DateTime? createdDate = default(System.DateTime?), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The lab's default storage account. + /// + + /// The lab's default premium storage account. + /// + + /// The lab's artifact storage account. + /// + + /// The lab's premium data disk storage account. + /// + + /// The lab's Key vault. + /// + + /// Type of storage used by the lab. It can be either Premium or Standard. + /// Default is Premium. + /// Possible values include: 'Standard', 'Premium' + + /// The creation date of the lab. + /// + + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. + /// Possible values include: 'Disabled', 'Enabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Lab(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string defaultStorageAccount = default(string), string defaultPremiumStorageAccount = default(string), string artifactsStorageAccount = default(string), string premiumDataDiskStorageAccount = default(string), string vaultName = default(string), string labStorageType = default(string), System.DateTime? createdDate = default(System.DateTime?), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - DefaultStorageAccount = defaultStorageAccount; - DefaultPremiumStorageAccount = defaultPremiumStorageAccount; - ArtifactsStorageAccount = artifactsStorageAccount; - PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; - VaultName = vaultName; - LabStorageType = labStorageType; - CreatedDate = createdDate; - PremiumDataDisks = premiumDataDisks; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.DefaultStorageAccount = defaultStorageAccount; + this.DefaultPremiumStorageAccount = defaultPremiumStorageAccount; + this.ArtifactsStorageAccount = artifactsStorageAccount; + this.PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; + this.VaultName = vaultName; + this.LabStorageType = labStorageType; + this.CreatedDate = createdDate; + this.PremiumDataDisks = premiumDataDisks; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -83,71 +96,70 @@ public Lab() /// partial void CustomInit(); + /// - /// Gets the lab's default storage account. + /// Gets the lab's default storage account. /// - [JsonProperty(PropertyName = "properties.defaultStorageAccount")] - public string DefaultStorageAccount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.defaultStorageAccount")] + public string DefaultStorageAccount {get; private set; } /// - /// Gets the lab's default premium storage account. + /// Gets the lab's default premium storage account. /// - [JsonProperty(PropertyName = "properties.defaultPremiumStorageAccount")] - public string DefaultPremiumStorageAccount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.defaultPremiumStorageAccount")] + public string DefaultPremiumStorageAccount {get; private set; } /// - /// Gets the lab's artifact storage account. + /// Gets the lab's artifact storage account. /// - [JsonProperty(PropertyName = "properties.artifactsStorageAccount")] - public string ArtifactsStorageAccount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifactsStorageAccount")] + public string ArtifactsStorageAccount {get; private set; } /// - /// Gets the lab's premium data disk storage account. + /// Gets the lab's premium data disk storage account. /// - [JsonProperty(PropertyName = "properties.premiumDataDiskStorageAccount")] - public string PremiumDataDiskStorageAccount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.premiumDataDiskStorageAccount")] + public string PremiumDataDiskStorageAccount {get; private set; } /// - /// Gets the lab's Key vault. + /// Gets the lab's Key vault. /// - [JsonProperty(PropertyName = "properties.vaultName")] - public string VaultName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vaultName")] + public string VaultName {get; private set; } /// - /// Gets or sets type of storage used by the lab. It can be either - /// Premium or Standard. Default is Premium. Possible values include: - /// 'Standard', 'Premium' + /// Gets or sets type of storage used by the lab. It can be either Premium or + /// Standard. Default is Premium. Possible values include: 'Standard', 'Premium' /// - [JsonProperty(PropertyName = "properties.labStorageType")] - public string LabStorageType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labStorageType")] + public string LabStorageType {get; set; } /// /// Gets the creation date of the lab. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets or sets the setting to enable usage of premium data disks. - /// When its value is 'Enabled', creation of standard or premium data - /// disks is allowed. - /// When its value is 'Disabled', only creation of standard data disks - /// is allowed. Possible values include: 'Disabled', 'Enabled' + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. Possible values include: 'Disabled', 'Enabled' /// - [JsonProperty(PropertyName = "properties.premiumDataDisks")] - public string PremiumDataDisks { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.premiumDataDisks")] + public string PremiumDataDisks {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs index 183dd8ada447..165d221f1e42 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A cost item. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class LabCost : Resource { /// @@ -34,40 +24,65 @@ public LabCost() /// /// Initializes a new instance of the LabCost class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The target cost properties - /// The lab cost summary component of the - /// cost data. - /// The lab cost details component of the - /// cost data. - /// The resource cost component of the cost - /// data. - /// The currency code of the cost. - /// The start time of the cost - /// data. - /// The end time of the cost data. - /// The creation date of the cost. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public LabCost(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), TargetCostProperties targetCost = default(TargetCostProperties), LabCostSummaryProperties labCostSummary = default(LabCostSummaryProperties), IList labCostDetails = default(IList), IList resourceCosts = default(IList), string currencyCode = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The target cost properties + /// + + /// The lab cost summary component of the cost data. + /// + + /// The lab cost details component of the cost data. + /// + + /// The resource cost component of the cost data. + /// + + /// The currency code of the cost. + /// + + /// The start time of the cost data. + /// + + /// The end time of the cost data. + /// + + /// The creation date of the cost. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabCost(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), TargetCostProperties targetCost = default(TargetCostProperties), LabCostSummaryProperties labCostSummary = default(LabCostSummaryProperties), System.Collections.Generic.IList labCostDetails = default(System.Collections.Generic.IList), System.Collections.Generic.IList resourceCosts = default(System.Collections.Generic.IList), string currencyCode = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - TargetCost = targetCost; - LabCostSummary = labCostSummary; - LabCostDetails = labCostDetails; - ResourceCosts = resourceCosts; - CurrencyCode = currencyCode; - StartDateTime = startDateTime; - EndDateTime = endDateTime; - CreatedDate = createdDate; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.TargetCost = targetCost; + this.LabCostSummary = labCostSummary; + this.LabCostDetails = labCostDetails; + this.ResourceCosts = resourceCosts; + this.CurrencyCode = currencyCode; + this.StartDateTime = startDateTime; + this.EndDateTime = endDateTime; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -76,65 +91,65 @@ public LabCost() /// partial void CustomInit(); + /// /// Gets or sets the target cost properties /// - [JsonProperty(PropertyName = "properties.targetCost")] - public TargetCostProperties TargetCost { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetCost")] + public TargetCostProperties TargetCost {get; set; } /// /// Gets the lab cost summary component of the cost data. /// - [JsonProperty(PropertyName = "properties.labCostSummary")] - public LabCostSummaryProperties LabCostSummary { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labCostSummary")] + public LabCostSummaryProperties LabCostSummary {get; private set; } /// /// Gets the lab cost details component of the cost data. /// - [JsonProperty(PropertyName = "properties.labCostDetails")] - public IList LabCostDetails { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labCostDetails")] + public System.Collections.Generic.IList LabCostDetails {get; private set; } /// /// Gets the resource cost component of the cost data. /// - [JsonProperty(PropertyName = "properties.resourceCosts")] - public IList ResourceCosts { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceCosts")] + public System.Collections.Generic.IList ResourceCosts {get; private set; } /// /// Gets or sets the currency code of the cost. /// - [JsonProperty(PropertyName = "properties.currencyCode")] - public string CurrencyCode { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.currencyCode")] + public string CurrencyCode {get; set; } /// /// Gets or sets the start time of the cost data. /// - [JsonProperty(PropertyName = "properties.startDateTime")] - public System.DateTime? StartDateTime { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.startDateTime")] + public System.DateTime? StartDateTime {get; set; } /// /// Gets or sets the end time of the cost data. /// - [JsonProperty(PropertyName = "properties.endDateTime")] - public System.DateTime? EndDateTime { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.endDateTime")] + public System.DateTime? EndDateTime {get; set; } /// /// Gets or sets the creation date of the cost. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs index fea51529c23f..b566f2c4d70e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,15 +23,21 @@ public LabCostDetailsProperties() /// /// Initializes a new instance of the LabCostDetailsProperties class. /// - /// The date of the cost item. - /// The cost component of the cost item. - /// The type of the cost. Possible values - /// include: 'Unavailable', 'Reported', 'Projected' + + /// The date of the cost item. + /// + + /// The cost component of the cost item. + /// + + /// The type of the cost. + /// Possible values include: 'Unavailable', 'Reported', 'Projected' public LabCostDetailsProperties(System.DateTime? date = default(System.DateTime?), double? cost = default(double?), string costType = default(string)) + { - Date = date; - Cost = cost; - CostType = costType; + this.Date = date; + this.Cost = cost; + this.CostType = costType; CustomInit(); } @@ -46,24 +46,23 @@ public LabCostDetailsProperties() /// partial void CustomInit(); + /// /// Gets or sets the date of the cost item. /// - [JsonProperty(PropertyName = "date")] - public System.DateTime? Date { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "date")] + public System.DateTime? Date {get; set; } /// /// Gets or sets the cost component of the cost item. /// - [JsonProperty(PropertyName = "cost")] - public double? Cost { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "cost")] + public double? Cost {get; set; } /// - /// Gets or sets the type of the cost. Possible values include: - /// 'Unavailable', 'Reported', 'Projected' + /// Gets or sets the type of the cost. Possible values include: 'Unavailable', 'Reported', 'Projected' /// - [JsonProperty(PropertyName = "costType")] - public string CostType { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "costType")] + public string CostType {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostProperties.cs new file mode 100644 index 000000000000..36756fa77542 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a cost item. + /// + public partial class LabCostProperties + { + /// + /// Initializes a new instance of the LabCostProperties class. + /// + public LabCostProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabCostProperties class. + /// + + /// The target cost properties + /// + + /// The lab cost summary component of the cost data. + /// + + /// The lab cost details component of the cost data. + /// + + /// The resource cost component of the cost data. + /// + + /// The currency code of the cost. + /// + + /// The start time of the cost data. + /// + + /// The end time of the cost data. + /// + + /// The creation date of the cost. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabCostProperties(TargetCostProperties targetCost = default(TargetCostProperties), LabCostSummaryProperties labCostSummary = default(LabCostSummaryProperties), System.Collections.Generic.IList labCostDetails = default(System.Collections.Generic.IList), System.Collections.Generic.IList resourceCosts = default(System.Collections.Generic.IList), string currencyCode = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.TargetCost = targetCost; + this.LabCostSummary = labCostSummary; + this.LabCostDetails = labCostDetails; + this.ResourceCosts = resourceCosts; + this.CurrencyCode = currencyCode; + this.StartDateTime = startDateTime; + this.EndDateTime = endDateTime; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the target cost properties + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetCost")] + public TargetCostProperties TargetCost {get; set; } + + /// + /// Gets the lab cost summary component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labCostSummary")] + public LabCostSummaryProperties LabCostSummary {get; private set; } + + /// + /// Gets the lab cost details component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labCostDetails")] + public System.Collections.Generic.IList LabCostDetails {get; private set; } + + /// + /// Gets the resource cost component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceCosts")] + public System.Collections.Generic.IList ResourceCosts {get; private set; } + + /// + /// Gets or sets the currency code of the cost. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currencyCode")] + public string CurrencyCode {get; set; } + + /// + /// Gets or sets the start time of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime {get; set; } + + /// + /// Gets or sets the end time of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDateTime")] + public System.DateTime? EndDateTime {get; set; } + + /// + /// Gets or sets the creation date of the cost. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs index daf9adcbff0e..28b69fcc8c9a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,13 @@ public LabCostSummaryProperties() /// /// Initializes a new instance of the LabCostSummaryProperties class. /// - /// The cost component of the cost - /// item. + + /// The cost component of the cost item. + /// public LabCostSummaryProperties(double? estimatedLabCost = default(double?)) + { - EstimatedLabCost = estimatedLabCost; + this.EstimatedLabCost = estimatedLabCost; CustomInit(); } @@ -42,11 +38,11 @@ public LabCostSummaryProperties() /// partial void CustomInit(); + /// /// Gets or sets the cost component of the cost item. /// - [JsonProperty(PropertyName = "estimatedLabCost")] - public double? EstimatedLabCost { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "estimatedLabCost")] + public double? EstimatedLabCost {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs index b6e84b1cb8ae..23f1c4933ec2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A lab. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class LabFragment : Resource { /// @@ -34,31 +24,46 @@ public LabFragment() /// /// Initializes a new instance of the LabFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// Type of storage used by the lab. It - /// can be either Premium or Standard. Default is Premium. Possible - /// values include: 'Standard', 'Premium' - /// The setting to enable usage of - /// premium data disks. - /// When its value is 'Enabled', creation of standard or premium data - /// disks is allowed. - /// When its value is 'Disabled', only creation of standard data disks - /// is allowed. Possible values include: 'Disabled', 'Enabled' - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public LabFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string labStorageType = default(string), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// Type of storage used by the lab. It can be either Premium or Standard. + /// Default is Premium. + /// Possible values include: 'Standard', 'Premium' + + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. + /// Possible values include: 'Disabled', 'Enabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string labStorageType = default(string), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - LabStorageType = labStorageType; - PremiumDataDisks = premiumDataDisks; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.LabStorageType = labStorageType; + this.PremiumDataDisks = premiumDataDisks; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -67,35 +72,34 @@ public LabFragment() /// partial void CustomInit(); + /// - /// Gets or sets type of storage used by the lab. It can be either - /// Premium or Standard. Default is Premium. Possible values include: - /// 'Standard', 'Premium' + /// Gets or sets type of storage used by the lab. It can be either Premium or + /// Standard. Default is Premium. Possible values include: 'Standard', 'Premium' /// - [JsonProperty(PropertyName = "properties.labStorageType")] - public string LabStorageType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labStorageType")] + public string LabStorageType {get; set; } /// /// Gets or sets the setting to enable usage of premium data disks. - /// When its value is 'Enabled', creation of standard or premium data - /// disks is allowed. - /// When its value is 'Disabled', only creation of standard data disks - /// is allowed. Possible values include: 'Disabled', 'Enabled' + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. Possible values include: 'Disabled', 'Enabled' /// - [JsonProperty(PropertyName = "properties.premiumDataDisks")] - public string PremiumDataDisks { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.premiumDataDisks")] + public string PremiumDataDisks {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabProperties.cs new file mode 100644 index 000000000000..bd36554be812 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabProperties.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a lab. + /// + public partial class LabProperties + { + /// + /// Initializes a new instance of the LabProperties class. + /// + public LabProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabProperties class. + /// + + /// The lab's default storage account. + /// + + /// The lab's default premium storage account. + /// + + /// The lab's artifact storage account. + /// + + /// The lab's premium data disk storage account. + /// + + /// The lab's Key vault. + /// + + /// Type of storage used by the lab. It can be either Premium or Standard. + /// Default is Premium. + /// Possible values include: 'Standard', 'Premium' + + /// The creation date of the lab. + /// + + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. + /// Possible values include: 'Disabled', 'Enabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabProperties(string defaultStorageAccount = default(string), string defaultPremiumStorageAccount = default(string), string artifactsStorageAccount = default(string), string premiumDataDiskStorageAccount = default(string), string vaultName = default(string), string labStorageType = default(string), System.DateTime? createdDate = default(System.DateTime?), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DefaultStorageAccount = defaultStorageAccount; + this.DefaultPremiumStorageAccount = defaultPremiumStorageAccount; + this.ArtifactsStorageAccount = artifactsStorageAccount; + this.PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; + this.VaultName = vaultName; + this.LabStorageType = labStorageType; + this.CreatedDate = createdDate; + this.PremiumDataDisks = premiumDataDisks; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the lab's default storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "defaultStorageAccount")] + public string DefaultStorageAccount {get; private set; } + + /// + /// Gets the lab's default premium storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "defaultPremiumStorageAccount")] + public string DefaultPremiumStorageAccount {get; private set; } + + /// + /// Gets the lab's artifact storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactsStorageAccount")] + public string ArtifactsStorageAccount {get; private set; } + + /// + /// Gets the lab's premium data disk storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "premiumDataDiskStorageAccount")] + public string PremiumDataDiskStorageAccount {get; private set; } + + /// + /// Gets the lab's Key vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vaultName")] + public string VaultName {get; private set; } + + /// + /// Gets or sets type of storage used by the lab. It can be either Premium or + /// Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labStorageType")] + public string LabStorageType {get; set; } + + /// + /// Gets the creation date of the lab. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. Possible values include: 'Disabled', 'Enabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "premiumDataDisks")] + public string PremiumDataDisks {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabPropertiesFragment.cs new file mode 100644 index 000000000000..95e86f359521 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabPropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a lab. + /// + public partial class LabPropertiesFragment + { + /// + /// Initializes a new instance of the LabPropertiesFragment class. + /// + public LabPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabPropertiesFragment class. + /// + + /// Type of storage used by the lab. It can be either Premium or Standard. + /// Default is Premium. + /// Possible values include: 'Standard', 'Premium' + + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. + /// Possible values include: 'Disabled', 'Enabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabPropertiesFragment(string labStorageType = default(string), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.LabStorageType = labStorageType; + this.PremiumDataDisks = premiumDataDisks; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets type of storage used by the lab. It can be either Premium or + /// Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labStorageType")] + public string LabStorageType {get; set; } + + /// + /// Gets or sets the setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. Possible values include: 'Disabled', 'Enabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "premiumDataDisks")] + public string PremiumDataDisks {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs index 0f86d89962d6..d9c74625cb50 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,33 +23,45 @@ public LabResourceCostProperties() /// /// Initializes a new instance of the LabResourceCostProperties class. /// - /// The name of the resource. - /// The unique identifier of the - /// resource. - /// The cost component of the resource cost - /// item. - /// The logical resource type (ex. - /// virtualmachine, storageaccount) - /// The owner of the resource (ex. - /// janedoe@microsoft.com) - /// The category of the resource (ex. - /// Premium_LRS, Standard_DS1) - /// The status of the resource (ex. - /// Active) - /// The ID of the resource - /// The ID of the external - /// resource + + /// The name of the resource. + /// + + /// The unique identifier of the resource. + /// + + /// The cost component of the resource cost item. + /// + + /// The logical resource type (ex. virtualmachine, storageaccount) + /// + + /// The owner of the resource (ex. janedoe@microsoft.com) + /// + + /// The category of the resource (ex. Premium_LRS, Standard_DS1) + /// + + /// The status of the resource (ex. Active) + /// + + /// The ID of the resource + /// + + /// The ID of the external resource + /// public LabResourceCostProperties(string resourcename = default(string), string resourceUId = default(string), double? resourceCost = default(double?), string resourceType = default(string), string resourceOwner = default(string), string resourcePricingTier = default(string), string resourceStatus = default(string), string resourceId = default(string), string externalResourceId = default(string)) + { - Resourcename = resourcename; - ResourceUId = resourceUId; - ResourceCost = resourceCost; - ResourceType = resourceType; - ResourceOwner = resourceOwner; - ResourcePricingTier = resourcePricingTier; - ResourceStatus = resourceStatus; - ResourceId = resourceId; - ExternalResourceId = externalResourceId; + this.Resourcename = resourcename; + this.ResourceUId = resourceUId; + this.ResourceCost = resourceCost; + this.ResourceType = resourceType; + this.ResourceOwner = resourceOwner; + this.ResourcePricingTier = resourcePricingTier; + this.ResourceStatus = resourceStatus; + this.ResourceId = resourceId; + this.ExternalResourceId = externalResourceId; CustomInit(); } @@ -64,61 +70,59 @@ public LabResourceCostProperties() /// partial void CustomInit(); + /// /// Gets or sets the name of the resource. /// - [JsonProperty(PropertyName = "resourcename")] - public string Resourcename { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourcename")] + public string Resourcename {get; set; } /// /// Gets or sets the unique identifier of the resource. /// - [JsonProperty(PropertyName = "resourceUId")] - public string ResourceUId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceUId")] + public string ResourceUId {get; set; } /// /// Gets or sets the cost component of the resource cost item. /// - [JsonProperty(PropertyName = "resourceCost")] - public double? ResourceCost { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceCost")] + public double? ResourceCost {get; set; } /// - /// Gets or sets the logical resource type (ex. virtualmachine, - /// storageaccount) + /// Gets or sets the logical resource type (ex. virtualmachine, storageaccount) /// - [JsonProperty(PropertyName = "resourceType")] - public string ResourceType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceType")] + public string ResourceType {get; set; } /// /// Gets or sets the owner of the resource (ex. janedoe@microsoft.com) /// - [JsonProperty(PropertyName = "resourceOwner")] - public string ResourceOwner { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceOwner")] + public string ResourceOwner {get; set; } /// - /// Gets or sets the category of the resource (ex. Premium_LRS, - /// Standard_DS1) + /// Gets or sets the category of the resource (ex. Premium_LRS, Standard_DS1) /// - [JsonProperty(PropertyName = "resourcePricingTier")] - public string ResourcePricingTier { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourcePricingTier")] + public string ResourcePricingTier {get; set; } /// /// Gets or sets the status of the resource (ex. Active) /// - [JsonProperty(PropertyName = "resourceStatus")] - public string ResourceStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceStatus")] + public string ResourceStatus {get; set; } /// /// Gets or sets the ID of the resource /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } /// /// Gets or sets the ID of the external resource /// - [JsonProperty(PropertyName = "externalResourceId")] - public string ExternalResourceId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "externalResourceId")] + public string ExternalResourceId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs index b95d812861e2..f72ce4fc7d14 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,10 +23,13 @@ public LabVhd() /// /// Initializes a new instance of the LabVhd class. /// - /// The URI to the VHD. + + /// The URI to the VHD. + /// public LabVhd(string id = default(string)) + { - Id = id; + this.Id = id; CustomInit(); } @@ -41,11 +38,11 @@ public LabVhd() /// partial void CustomInit(); + /// /// Gets or sets the URI to the VHD. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs index 1508160c0869..03fedc82a677 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A virtual machine. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class LabVirtualMachine : Resource { /// @@ -34,104 +24,151 @@ public LabVirtualMachine() /// /// Initializes a new instance of the LabVirtualMachine class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The notes of the virtual machine. - /// The object identifier of the owner of - /// the virtual machine. - /// The user principal name of the - /// virtual machine owner. - /// The object identifier of the creator - /// of the virtual machine. - /// The email address of creator of the - /// virtual machine. - /// The creation date of the virtual - /// machine. - /// The resource identifier (Microsoft.Compute) - /// of the virtual machine. - /// The custom image identifier of the - /// virtual machine. - /// The OS type of the virtual machine. - /// The size of the virtual machine. - /// The user name of the virtual - /// machine. - /// The password of the virtual machine - /// administrator. - /// The SSH key of the virtual machine - /// administrator. - /// Indicates whether this - /// virtual machine uses an SSH key for authentication. - /// The fully-qualified domain name of the virtual - /// machine. - /// The lab subnet name of the virtual - /// machine. - /// The lab virtual network - /// identifier of the virtual machine. - /// Indicates whether the virtual - /// machine is to be created without a public IP address. - /// The artifacts to be installed on the - /// virtual machine. - /// The artifact deployment - /// status for the virtual machine. - /// The Microsoft Azure Marketplace - /// image reference of the virtual machine. - /// The compute virtual machine - /// properties. - /// The network interface - /// properties. - /// The applicable schedule for the - /// virtual machine. - /// The expiration date for VM. - /// Indicates whether another user can take - /// ownership of the virtual machine - /// Storage type to use for virtual machine - /// (i.e. Standard, Premium). - /// Tells source of creation - /// of lab virtual machine. Output property only. Possible values - /// include: 'FromCustomImage', 'FromGalleryImage' - /// The resource ID of the environment that - /// contains this virtual machine, if any. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public LabVirtualMachine(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVm = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The resource identifier (Microsoft.Compute) of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachine(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVM = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Notes = notes; - OwnerObjectId = ownerObjectId; - OwnerUserPrincipalName = ownerUserPrincipalName; - CreatedByUserId = createdByUserId; - CreatedByUser = createdByUser; - CreatedDate = createdDate; - ComputeId = computeId; - CustomImageId = customImageId; - OsType = osType; - Size = size; - UserName = userName; - Password = password; - SshKey = sshKey; - IsAuthenticationWithSshKey = isAuthenticationWithSshKey; - Fqdn = fqdn; - LabSubnetName = labSubnetName; - LabVirtualNetworkId = labVirtualNetworkId; - DisallowPublicIpAddress = disallowPublicIpAddress; - Artifacts = artifacts; - ArtifactDeploymentStatus = artifactDeploymentStatus; - GalleryImageReference = galleryImageReference; - ComputeVm = computeVm; - NetworkInterface = networkInterface; - ApplicableSchedule = applicableSchedule; - ExpirationDate = expirationDate; - AllowClaim = allowClaim; - StorageType = storageType; - VirtualMachineCreationSource = virtualMachineCreationSource; - EnvironmentId = environmentId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.ApplicableSchedule = applicableSchedule; + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.ComputeId = computeId; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -140,205 +177,198 @@ public LabVirtualMachine() /// partial void CustomInit(); + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableSchedule ApplicableSchedule {get; set; } + /// /// Gets or sets the notes of the virtual machine. /// - [JsonProperty(PropertyName = "properties.notes")] - public string Notes { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notes")] + public string Notes {get; set; } /// - /// Gets or sets the object identifier of the owner of the virtual - /// machine. + /// Gets or sets the object identifier of the owner of the virtual machine. /// - [JsonProperty(PropertyName = "properties.ownerObjectId")] - public string OwnerObjectId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId {get; set; } /// /// Gets or sets the user principal name of the virtual machine owner. /// - [JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] - public string OwnerUserPrincipalName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } /// - /// Gets or sets the object identifier of the creator of the virtual - /// machine. + /// Gets or sets the object identifier of the creator of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdByUserId")] - public string CreatedByUserId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId {get; set; } /// /// Gets or sets the email address of creator of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdByUser")] - public string CreatedByUser { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser {get; set; } /// /// Gets or sets the creation date of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; set; } /// - /// Gets the resource identifier (Microsoft.Compute) of the virtual - /// machine. + /// Gets the resource identifier (Microsoft.Compute) of the virtual machine. /// - [JsonProperty(PropertyName = "properties.computeId")] - public string ComputeId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.computeId")] + public string ComputeId {get; private set; } /// /// Gets or sets the custom image identifier of the virtual machine. /// - [JsonProperty(PropertyName = "properties.customImageId")] - public string CustomImageId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId {get; set; } /// /// Gets or sets the OS type of the virtual machine. /// - [JsonProperty(PropertyName = "properties.osType")] - public string OsType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.osType")] + public string OSType {get; set; } /// /// Gets or sets the size of the virtual machine. /// - [JsonProperty(PropertyName = "properties.size")] - public string Size { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.size")] + public string Size {get; set; } /// /// Gets or sets the user name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.userName")] - public string UserName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userName")] + public string UserName {get; set; } /// /// Gets or sets the password of the virtual machine administrator. /// - [JsonProperty(PropertyName = "properties.password")] - public string Password { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.password")] + public string Password {get; set; } /// /// Gets or sets the SSH key of the virtual machine administrator. /// - [JsonProperty(PropertyName = "properties.sshKey")] - public string SshKey { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey {get; set; } /// - /// Gets or sets indicates whether this virtual machine uses an SSH key - /// for authentication. + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. /// - [JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] - public bool? IsAuthenticationWithSshKey { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } /// - /// Gets or sets the fully-qualified domain name of the virtual - /// machine. + /// Gets or sets the fully-qualified domain name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.fqdn")] - public string Fqdn { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn {get; set; } /// /// Gets or sets the lab subnet name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.labSubnetName")] - public string LabSubnetName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName {get; set; } /// - /// Gets or sets the lab virtual network identifier of the virtual - /// machine. + /// Gets or sets the lab virtual network identifier of the virtual machine. /// - [JsonProperty(PropertyName = "properties.labVirtualNetworkId")] - public string LabVirtualNetworkId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } /// - /// Gets or sets indicates whether the virtual machine is to be created - /// without a public IP address. + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. /// - [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] - public bool? DisallowPublicIpAddress { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } /// /// Gets or sets the artifacts to be installed on the virtual machine. /// - [JsonProperty(PropertyName = "properties.artifacts")] - public IList Artifacts { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } /// - /// Gets or sets the artifact deployment status for the virtual - /// machine. + /// Gets or sets the artifact deployment status for the virtual machine. /// - [JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] - public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus {get; set; } /// - /// Gets or sets the Microsoft Azure Marketplace image reference of the - /// virtual machine. + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. /// - [JsonProperty(PropertyName = "properties.galleryImageReference")] - public GalleryImageReference GalleryImageReference { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReference GalleryImageReference {get; set; } /// /// Gets or sets the compute virtual machine properties. /// - [JsonProperty(PropertyName = "properties.computeVm")] - public ComputeVmProperties ComputeVm { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmProperties ComputeVM {get; set; } /// /// Gets or sets the network interface properties. /// - [JsonProperty(PropertyName = "properties.networkInterface")] - public NetworkInterfaceProperties NetworkInterface { get; set; } - - /// - /// Gets or sets the applicable schedule for the virtual machine. - /// - [JsonProperty(PropertyName = "properties.applicableSchedule")] - public ApplicableSchedule ApplicableSchedule { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfaceProperties NetworkInterface {get; set; } /// /// Gets or sets the expiration date for VM. /// - [JsonProperty(PropertyName = "properties.expirationDate")] - public System.DateTime? ExpirationDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate {get; set; } /// - /// Gets or sets indicates whether another user can take ownership of - /// the virtual machine + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine /// - [JsonProperty(PropertyName = "properties.allowClaim")] - public bool? AllowClaim { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim {get; set; } /// - /// Gets or sets storage type to use for virtual machine (i.e. - /// Standard, Premium). + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). /// - [JsonProperty(PropertyName = "properties.storageType")] - public string StorageType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageType")] + public string StorageType {get; set; } /// - /// Gets or sets tells source of creation of lab virtual machine. - /// Output property only. Possible values include: 'FromCustomImage', - /// 'FromGalleryImage' + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' /// - [JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] - public string VirtualMachineCreationSource { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } /// - /// Gets or sets the resource ID of the environment that contains this - /// virtual machine, if any. + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. /// - [JsonProperty(PropertyName = "properties.environmentId")] - public string EnvironmentId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs index 0203eeee9632..7b93f0eba553 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs @@ -1,31 +1,20 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// Properties for creating a virtual machine. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class LabVirtualMachineCreationParameter { /// - /// Initializes a new instance of the - /// LabVirtualMachineCreationParameter class. + /// Initializes a new instance of the LabVirtualMachineCreationParameter class. /// public LabVirtualMachineCreationParameter() { @@ -33,109 +22,149 @@ public LabVirtualMachineCreationParameter() } /// - /// Initializes a new instance of the - /// LabVirtualMachineCreationParameter class. - /// - /// The number of virtual machine - /// instances to create. - /// The notes of the virtual machine. - /// The object identifier of the owner of - /// the virtual machine. - /// The user principal name of the - /// virtual machine owner. - /// The object identifier of the creator - /// of the virtual machine. - /// The email address of creator of the - /// virtual machine. - /// The creation date of the virtual - /// machine. - /// The custom image identifier of the - /// virtual machine. - /// The OS type of the virtual machine. - /// The size of the virtual machine. - /// The user name of the virtual - /// machine. - /// The password of the virtual machine - /// administrator. - /// The SSH key of the virtual machine - /// administrator. - /// Indicates whether this - /// virtual machine uses an SSH key for authentication. - /// The fully-qualified domain name of the virtual - /// machine. - /// The lab subnet name of the virtual - /// machine. - /// The lab virtual network - /// identifier of the virtual machine. - /// Indicates whether the virtual - /// machine is to be created without a public IP address. - /// The artifacts to be installed on the - /// virtual machine. - /// The artifact deployment - /// status for the virtual machine. - /// The Microsoft Azure Marketplace - /// image reference of the virtual machine. - /// The compute virtual machine - /// properties. - /// The network interface - /// properties. - /// The applicable schedule for the - /// virtual machine. - /// The expiration date for VM. - /// Indicates whether another user can take - /// ownership of the virtual machine - /// Storage type to use for virtual machine - /// (i.e. Standard, Premium). - /// Tells source of creation - /// of lab virtual machine. Output property only. Possible values - /// include: 'FromCustomImage', 'FromGalleryImage' - /// The resource ID of the environment that - /// contains this virtual machine, if any. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - /// The name of the virtual machine or - /// environment - /// The location of the new virtual machine or - /// environment - /// The tags of the resource. - public LabVirtualMachineCreationParameter(BulkCreationParameters bulkCreationParameters = default(BulkCreationParameters), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVm = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + /// Initializes a new instance of the LabVirtualMachineCreationParameter class. + /// + + /// The name of the virtual machine or environment + /// + + /// The location of the new virtual machine or environment + /// + + /// The tags of the resource. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The number of virtual machine instances to create. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachineCreationParameter(string name = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), BulkCreationParameters bulkCreationParameters = default(BulkCreationParameters), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVM = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + { - BulkCreationParameters = bulkCreationParameters; - Notes = notes; - OwnerObjectId = ownerObjectId; - OwnerUserPrincipalName = ownerUserPrincipalName; - CreatedByUserId = createdByUserId; - CreatedByUser = createdByUser; - CreatedDate = createdDate; - CustomImageId = customImageId; - OsType = osType; - Size = size; - UserName = userName; - Password = password; - SshKey = sshKey; - IsAuthenticationWithSshKey = isAuthenticationWithSshKey; - Fqdn = fqdn; - LabSubnetName = labSubnetName; - LabVirtualNetworkId = labVirtualNetworkId; - DisallowPublicIpAddress = disallowPublicIpAddress; - Artifacts = artifacts; - ArtifactDeploymentStatus = artifactDeploymentStatus; - GalleryImageReference = galleryImageReference; - ComputeVm = computeVm; - NetworkInterface = networkInterface; - ApplicableSchedule = applicableSchedule; - ExpirationDate = expirationDate; - AllowClaim = allowClaim; - StorageType = storageType; - VirtualMachineCreationSource = virtualMachineCreationSource; - EnvironmentId = environmentId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - Name = name; - Location = location; - Tags = tags; + this.Name = name; + this.Location = location; + this.Tags = tags; + this.ApplicableSchedule = applicableSchedule; + this.BulkCreationParameters = bulkCreationParameters; + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -144,222 +173,216 @@ public LabVirtualMachineCreationParameter() /// partial void CustomInit(); + + /// + /// Gets or sets the name of the virtual machine or environment + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the location of the new virtual machine or environment + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets the tags of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableSchedule ApplicableSchedule {get; set; } + /// /// Gets or sets the number of virtual machine instances to create. /// - [JsonProperty(PropertyName = "properties.bulkCreationParameters")] - public BulkCreationParameters BulkCreationParameters { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.bulkCreationParameters")] + public BulkCreationParameters BulkCreationParameters {get; set; } /// /// Gets or sets the notes of the virtual machine. /// - [JsonProperty(PropertyName = "properties.notes")] - public string Notes { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notes")] + public string Notes {get; set; } /// - /// Gets or sets the object identifier of the owner of the virtual - /// machine. + /// Gets or sets the object identifier of the owner of the virtual machine. /// - [JsonProperty(PropertyName = "properties.ownerObjectId")] - public string OwnerObjectId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId {get; set; } /// /// Gets or sets the user principal name of the virtual machine owner. /// - [JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] - public string OwnerUserPrincipalName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } /// - /// Gets or sets the object identifier of the creator of the virtual - /// machine. + /// Gets or sets the object identifier of the creator of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdByUserId")] - public string CreatedByUserId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId {get; set; } /// /// Gets or sets the email address of creator of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdByUser")] - public string CreatedByUser { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser {get; set; } /// /// Gets or sets the creation date of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; set; } /// /// Gets or sets the custom image identifier of the virtual machine. /// - [JsonProperty(PropertyName = "properties.customImageId")] - public string CustomImageId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId {get; set; } /// /// Gets or sets the OS type of the virtual machine. /// - [JsonProperty(PropertyName = "properties.osType")] - public string OsType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.osType")] + public string OSType {get; set; } /// /// Gets or sets the size of the virtual machine. /// - [JsonProperty(PropertyName = "properties.size")] - public string Size { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.size")] + public string Size {get; set; } /// /// Gets or sets the user name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.userName")] - public string UserName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userName")] + public string UserName {get; set; } /// /// Gets or sets the password of the virtual machine administrator. /// - [JsonProperty(PropertyName = "properties.password")] - public string Password { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.password")] + public string Password {get; set; } /// /// Gets or sets the SSH key of the virtual machine administrator. /// - [JsonProperty(PropertyName = "properties.sshKey")] - public string SshKey { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey {get; set; } /// - /// Gets or sets indicates whether this virtual machine uses an SSH key - /// for authentication. + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. /// - [JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] - public bool? IsAuthenticationWithSshKey { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } /// - /// Gets or sets the fully-qualified domain name of the virtual - /// machine. + /// Gets or sets the fully-qualified domain name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.fqdn")] - public string Fqdn { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn {get; set; } /// /// Gets or sets the lab subnet name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.labSubnetName")] - public string LabSubnetName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName {get; set; } /// - /// Gets or sets the lab virtual network identifier of the virtual - /// machine. + /// Gets or sets the lab virtual network identifier of the virtual machine. /// - [JsonProperty(PropertyName = "properties.labVirtualNetworkId")] - public string LabVirtualNetworkId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } /// - /// Gets or sets indicates whether the virtual machine is to be created - /// without a public IP address. + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. /// - [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] - public bool? DisallowPublicIpAddress { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } /// /// Gets or sets the artifacts to be installed on the virtual machine. /// - [JsonProperty(PropertyName = "properties.artifacts")] - public IList Artifacts { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } /// - /// Gets or sets the artifact deployment status for the virtual - /// machine. + /// Gets or sets the artifact deployment status for the virtual machine. /// - [JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] - public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus {get; set; } /// - /// Gets or sets the Microsoft Azure Marketplace image reference of the - /// virtual machine. + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. /// - [JsonProperty(PropertyName = "properties.galleryImageReference")] - public GalleryImageReference GalleryImageReference { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReference GalleryImageReference {get; set; } /// /// Gets or sets the compute virtual machine properties. /// - [JsonProperty(PropertyName = "properties.computeVm")] - public ComputeVmProperties ComputeVm { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmProperties ComputeVM {get; set; } /// /// Gets or sets the network interface properties. /// - [JsonProperty(PropertyName = "properties.networkInterface")] - public NetworkInterfaceProperties NetworkInterface { get; set; } - - /// - /// Gets or sets the applicable schedule for the virtual machine. - /// - [JsonProperty(PropertyName = "properties.applicableSchedule")] - public ApplicableSchedule ApplicableSchedule { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfaceProperties NetworkInterface {get; set; } /// /// Gets or sets the expiration date for VM. /// - [JsonProperty(PropertyName = "properties.expirationDate")] - public System.DateTime? ExpirationDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate {get; set; } /// - /// Gets or sets indicates whether another user can take ownership of - /// the virtual machine + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine /// - [JsonProperty(PropertyName = "properties.allowClaim")] - public bool? AllowClaim { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim {get; set; } /// - /// Gets or sets storage type to use for virtual machine (i.e. - /// Standard, Premium). + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). /// - [JsonProperty(PropertyName = "properties.storageType")] - public string StorageType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageType")] + public string StorageType {get; set; } /// - /// Gets or sets tells source of creation of lab virtual machine. - /// Output property only. Possible values include: 'FromCustomImage', - /// 'FromGalleryImage' + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' /// - [JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] - public string VirtualMachineCreationSource { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } /// - /// Gets or sets the resource ID of the environment that contains this - /// virtual machine, if any. + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. /// - [JsonProperty(PropertyName = "properties.environmentId")] - public string EnvironmentId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - /// - /// Gets or sets the name of the virtual machine or environment - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the location of the new virtual machine or environment - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the tags of the resource. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterProperties.cs new file mode 100644 index 000000000000..6d1152d4946a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for virtual machine creation. + /// + public partial class LabVirtualMachineCreationParameterProperties + { + /// + /// Initializes a new instance of the LabVirtualMachineCreationParameterProperties class. + /// + public LabVirtualMachineCreationParameterProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachineCreationParameterProperties class. + /// + + /// The number of virtual machine instances to create. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachineCreationParameterProperties(BulkCreationParameters bulkCreationParameters = default(BulkCreationParameters), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVM = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.BulkCreationParameters = bulkCreationParameters; + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ApplicableSchedule = applicableSchedule; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the number of virtual machine instances to create. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "bulkCreationParameters")] + public BulkCreationParameters BulkCreationParameters {get; set; } + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "galleryImageReference")] + public GalleryImageReference GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "computeVm")] + public ComputeVmProperties ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterface")] + public NetworkInterfaceProperties NetworkInterface {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "applicableSchedule")] + public ApplicableSchedule ApplicableSchedule {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs index 992cbff8c67b..1179a08dcbe4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A virtual machine. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class LabVirtualMachineFragment : Resource { /// @@ -34,101 +24,147 @@ public LabVirtualMachineFragment() /// /// Initializes a new instance of the LabVirtualMachineFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The notes of the virtual machine. - /// The object identifier of the owner of - /// the virtual machine. - /// The user principal name of the - /// virtual machine owner. - /// The object identifier of the creator - /// of the virtual machine. - /// The email address of creator of the - /// virtual machine. - /// The creation date of the virtual - /// machine. - /// The custom image identifier of the - /// virtual machine. - /// The OS type of the virtual machine. - /// The size of the virtual machine. - /// The user name of the virtual - /// machine. - /// The password of the virtual machine - /// administrator. - /// The SSH key of the virtual machine - /// administrator. - /// Indicates whether this - /// virtual machine uses an SSH key for authentication. - /// The fully-qualified domain name of the virtual - /// machine. - /// The lab subnet name of the virtual - /// machine. - /// The lab virtual network - /// identifier of the virtual machine. - /// Indicates whether the virtual - /// machine is to be created without a public IP address. - /// The artifacts to be installed on the - /// virtual machine. - /// The artifact deployment - /// status for the virtual machine. - /// The Microsoft Azure Marketplace - /// image reference of the virtual machine. - /// The compute virtual machine - /// properties. - /// The network interface - /// properties. - /// The applicable schedule for the - /// virtual machine. - /// The expiration date for VM. - /// Indicates whether another user can take - /// ownership of the virtual machine - /// Storage type to use for virtual machine - /// (i.e. Standard, Premium). - /// Tells source of creation - /// of lab virtual machine. Output property only. Possible values - /// include: 'FromCustomImage', 'FromGalleryImage' - /// The resource ID of the environment that - /// contains this virtual machine, if any. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public LabVirtualMachineFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIpAddress = default(bool?), IList artifacts = default(IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), ComputeVmPropertiesFragment computeVm = default(ComputeVmPropertiesFragment), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), ApplicableScheduleFragment applicableSchedule = default(ApplicableScheduleFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachineFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), ComputeVmPropertiesFragment computeVM = default(ComputeVmPropertiesFragment), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), ApplicableScheduleFragment applicableSchedule = default(ApplicableScheduleFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Notes = notes; - OwnerObjectId = ownerObjectId; - OwnerUserPrincipalName = ownerUserPrincipalName; - CreatedByUserId = createdByUserId; - CreatedByUser = createdByUser; - CreatedDate = createdDate; - CustomImageId = customImageId; - OsType = osType; - Size = size; - UserName = userName; - Password = password; - SshKey = sshKey; - IsAuthenticationWithSshKey = isAuthenticationWithSshKey; - Fqdn = fqdn; - LabSubnetName = labSubnetName; - LabVirtualNetworkId = labVirtualNetworkId; - DisallowPublicIpAddress = disallowPublicIpAddress; - Artifacts = artifacts; - ArtifactDeploymentStatus = artifactDeploymentStatus; - GalleryImageReference = galleryImageReference; - ComputeVm = computeVm; - NetworkInterface = networkInterface; - ApplicableSchedule = applicableSchedule; - ExpirationDate = expirationDate; - AllowClaim = allowClaim; - StorageType = storageType; - VirtualMachineCreationSource = virtualMachineCreationSource; - EnvironmentId = environmentId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ApplicableSchedule = applicableSchedule; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -137,198 +173,192 @@ public LabVirtualMachineFragment() /// partial void CustomInit(); + /// /// Gets or sets the notes of the virtual machine. /// - [JsonProperty(PropertyName = "properties.notes")] - public string Notes { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notes")] + public string Notes {get; set; } /// - /// Gets or sets the object identifier of the owner of the virtual - /// machine. + /// Gets or sets the object identifier of the owner of the virtual machine. /// - [JsonProperty(PropertyName = "properties.ownerObjectId")] - public string OwnerObjectId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId {get; set; } /// /// Gets or sets the user principal name of the virtual machine owner. /// - [JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] - public string OwnerUserPrincipalName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } /// - /// Gets or sets the object identifier of the creator of the virtual - /// machine. + /// Gets or sets the object identifier of the creator of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdByUserId")] - public string CreatedByUserId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId {get; set; } /// /// Gets or sets the email address of creator of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdByUser")] - public string CreatedByUser { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser {get; set; } /// /// Gets or sets the creation date of the virtual machine. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; set; } /// /// Gets or sets the custom image identifier of the virtual machine. /// - [JsonProperty(PropertyName = "properties.customImageId")] - public string CustomImageId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId {get; set; } /// /// Gets or sets the OS type of the virtual machine. /// - [JsonProperty(PropertyName = "properties.osType")] - public string OsType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.osType")] + public string OSType {get; set; } /// /// Gets or sets the size of the virtual machine. /// - [JsonProperty(PropertyName = "properties.size")] - public string Size { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.size")] + public string Size {get; set; } /// /// Gets or sets the user name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.userName")] - public string UserName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userName")] + public string UserName {get; set; } /// /// Gets or sets the password of the virtual machine administrator. /// - [JsonProperty(PropertyName = "properties.password")] - public string Password { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.password")] + public string Password {get; set; } /// /// Gets or sets the SSH key of the virtual machine administrator. /// - [JsonProperty(PropertyName = "properties.sshKey")] - public string SshKey { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey {get; set; } /// - /// Gets or sets indicates whether this virtual machine uses an SSH key - /// for authentication. + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. /// - [JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] - public bool? IsAuthenticationWithSshKey { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } /// - /// Gets or sets the fully-qualified domain name of the virtual - /// machine. + /// Gets or sets the fully-qualified domain name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.fqdn")] - public string Fqdn { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn {get; set; } /// /// Gets or sets the lab subnet name of the virtual machine. /// - [JsonProperty(PropertyName = "properties.labSubnetName")] - public string LabSubnetName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName {get; set; } /// - /// Gets or sets the lab virtual network identifier of the virtual - /// machine. + /// Gets or sets the lab virtual network identifier of the virtual machine. /// - [JsonProperty(PropertyName = "properties.labVirtualNetworkId")] - public string LabVirtualNetworkId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } /// - /// Gets or sets indicates whether the virtual machine is to be created - /// without a public IP address. + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. /// - [JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] - public bool? DisallowPublicIpAddress { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } /// /// Gets or sets the artifacts to be installed on the virtual machine. /// - [JsonProperty(PropertyName = "properties.artifacts")] - public IList Artifacts { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } /// - /// Gets or sets the artifact deployment status for the virtual - /// machine. + /// Gets or sets the artifact deployment status for the virtual machine. /// - [JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] - public ArtifactDeploymentStatusPropertiesFragment ArtifactDeploymentStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusPropertiesFragment ArtifactDeploymentStatus {get; set; } /// - /// Gets or sets the Microsoft Azure Marketplace image reference of the - /// virtual machine. + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. /// - [JsonProperty(PropertyName = "properties.galleryImageReference")] - public GalleryImageReferenceFragment GalleryImageReference { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReferenceFragment GalleryImageReference {get; set; } /// /// Gets or sets the compute virtual machine properties. /// - [JsonProperty(PropertyName = "properties.computeVm")] - public ComputeVmPropertiesFragment ComputeVm { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmPropertiesFragment ComputeVM {get; set; } /// /// Gets or sets the network interface properties. /// - [JsonProperty(PropertyName = "properties.networkInterface")] - public NetworkInterfacePropertiesFragment NetworkInterface { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfacePropertiesFragment NetworkInterface {get; set; } /// /// Gets or sets the applicable schedule for the virtual machine. /// - [JsonProperty(PropertyName = "properties.applicableSchedule")] - public ApplicableScheduleFragment ApplicableSchedule { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableScheduleFragment ApplicableSchedule {get; set; } /// /// Gets or sets the expiration date for VM. /// - [JsonProperty(PropertyName = "properties.expirationDate")] - public System.DateTime? ExpirationDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate {get; set; } /// - /// Gets or sets indicates whether another user can take ownership of - /// the virtual machine + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine /// - [JsonProperty(PropertyName = "properties.allowClaim")] - public bool? AllowClaim { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim {get; set; } /// - /// Gets or sets storage type to use for virtual machine (i.e. - /// Standard, Premium). + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). /// - [JsonProperty(PropertyName = "properties.storageType")] - public string StorageType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageType")] + public string StorageType {get; set; } /// - /// Gets or sets tells source of creation of lab virtual machine. - /// Output property only. Possible values include: 'FromCustomImage', - /// 'FromGalleryImage' + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' /// - [JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] - public string VirtualMachineCreationSource { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } /// - /// Gets or sets the resource ID of the environment that contains this - /// virtual machine, if any. + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. /// - [JsonProperty(PropertyName = "properties.environmentId")] - public string EnvironmentId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineProperties.cs new file mode 100644 index 000000000000..98af8448e611 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual machine. + /// + public partial class LabVirtualMachineProperties + { + /// + /// Initializes a new instance of the LabVirtualMachineProperties class. + /// + public LabVirtualMachineProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachineProperties class. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The resource identifier (Microsoft.Compute) of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachineProperties(string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVM = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.ComputeId = computeId; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ApplicableSchedule = applicableSchedule; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets the resource identifier (Microsoft.Compute) of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "computeId")] + public string ComputeId {get; private set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "galleryImageReference")] + public GalleryImageReference GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "computeVm")] + public ComputeVmProperties ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterface")] + public NetworkInterfaceProperties NetworkInterface {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "applicableSchedule")] + public ApplicableSchedule ApplicableSchedule {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachinePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachinePropertiesFragment.cs new file mode 100644 index 000000000000..356465ca92c8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachinePropertiesFragment.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual machine. + /// + public partial class LabVirtualMachinePropertiesFragment + { + /// + /// Initializes a new instance of the LabVirtualMachinePropertiesFragment class. + /// + public LabVirtualMachinePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachinePropertiesFragment class. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachinePropertiesFragment(string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), ComputeVmPropertiesFragment computeVM = default(ComputeVmPropertiesFragment), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), ApplicableScheduleFragment applicableSchedule = default(ApplicableScheduleFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ApplicableSchedule = applicableSchedule; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactDeploymentStatus")] + public ArtifactDeploymentStatusPropertiesFragment ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "galleryImageReference")] + public GalleryImageReferenceFragment GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "computeVm")] + public ComputeVmPropertiesFragment ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterface")] + public NetworkInterfacePropertiesFragment NetworkInterface {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "applicableSchedule")] + public ApplicableScheduleFragment ApplicableSchedule {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs index cdd1c1023010..3c5634f8c405 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,13 +23,15 @@ public LinuxOsInfo() /// /// Initializes a new instance of the LinuxOsInfo class. /// - /// The state of the Linux OS (i.e. - /// NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). - /// Possible values include: 'NonDeprovisioned', - /// 'DeprovisionRequested', 'DeprovisionApplied' - public LinuxOsInfo(string linuxOsState = default(string)) + + /// The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, + /// DeprovisionApplied). + /// Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', + /// 'DeprovisionApplied' + public LinuxOsInfo(string linuxOSState = default(string)) + { - LinuxOsState = linuxOsState; + this.LinuxOSState = linuxOSState; CustomInit(); } @@ -44,13 +40,12 @@ public LinuxOsInfo() /// partial void CustomInit(); + /// /// Gets or sets the state of the Linux OS (i.e. NonDeprovisioned, - /// DeprovisionRequested, DeprovisionApplied). Possible values include: - /// 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' + /// DeprovisionRequested, DeprovisionApplied). Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' /// - [JsonProperty(PropertyName = "linuxOsState")] - public string LinuxOsState { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "linuxOsState")] + public string LinuxOSState {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs index 2c5212fbb8ab..35fad833c348 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for LinuxOsState. /// + + public static class LinuxOsState { public const string NonDeprovisioned = "NonDeprovisioned"; public const string DeprovisionRequested = "DeprovisionRequested"; public const string DeprovisionApplied = "DeprovisionApplied"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs index af26330b86bd..59d8c15b832a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,34 +23,48 @@ public NetworkInterfaceProperties() /// /// Initializes a new instance of the NetworkInterfaceProperties class. /// - /// The resource ID of the virtual - /// network. - /// The resource ID of the sub net. - /// The resource ID of the public IP - /// address. - /// The public IP address. - /// The private IP address. - /// The DNS name. - /// The RdpAuthority property is a server - /// DNS host name or IP address followed by the service port number for - /// RDP (Remote Desktop Protocol). - /// The SshAuthority property is a server - /// DNS host name or IP address followed by the service port number for - /// SSH. - /// The configuration - /// for sharing a public IP address across multiple virtual - /// machines. - public NetworkInterfaceProperties(string virtualNetworkId = default(string), string subnetId = default(string), string publicIpAddressId = default(string), string publicIpAddress = default(string), string privateIpAddress = default(string), string dnsName = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), SharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration = default(SharedPublicIpAddressConfiguration)) + + /// The resource ID of the virtual network. + /// + + /// The resource ID of the sub net. + /// + + /// The resource ID of the public IP address. + /// + + /// The public IP address. + /// + + /// The private IP address. + /// + + /// The DNS name. + /// + + /// The RdpAuthority property is a server DNS host name or IP address followed + /// by the service port number for RDP (Remote Desktop Protocol). + /// + + /// The SshAuthority property is a server DNS host name or IP address followed + /// by the service port number for SSH. + /// + + /// The configuration for sharing a public IP address across multiple virtual + /// machines. + /// + public NetworkInterfaceProperties(string virtualNetworkId = default(string), string subnetId = default(string), string publicIPAddressId = default(string), string publicIPAddress = default(string), string privateIPAddress = default(string), string dnsName = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), SharedPublicIpAddressConfiguration sharedPublicIPAddressConfiguration = default(SharedPublicIpAddressConfiguration)) + { - VirtualNetworkId = virtualNetworkId; - SubnetId = subnetId; - PublicIpAddressId = publicIpAddressId; - PublicIpAddress = publicIpAddress; - PrivateIpAddress = privateIpAddress; - DnsName = dnsName; - RdpAuthority = rdpAuthority; - SshAuthority = sshAuthority; - SharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + this.VirtualNetworkId = virtualNetworkId; + this.SubnetId = subnetId; + this.PublicIPAddressId = publicIPAddressId; + this.PublicIPAddress = publicIPAddress; + this.PrivateIPAddress = privateIPAddress; + this.DnsName = dnsName; + this.RdpAuthority = rdpAuthority; + this.SshAuthority = sshAuthority; + this.SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; CustomInit(); } @@ -65,63 +73,63 @@ public NetworkInterfaceProperties() /// partial void CustomInit(); + /// /// Gets or sets the resource ID of the virtual network. /// - [JsonProperty(PropertyName = "virtualNetworkId")] - public string VirtualNetworkId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkId")] + public string VirtualNetworkId {get; set; } /// /// Gets or sets the resource ID of the sub net. /// - [JsonProperty(PropertyName = "subnetId")] - public string SubnetId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetId")] + public string SubnetId {get; set; } /// /// Gets or sets the resource ID of the public IP address. /// - [JsonProperty(PropertyName = "publicIpAddressId")] - public string PublicIpAddressId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIpAddressId")] + public string PublicIPAddressId {get; set; } /// /// Gets or sets the public IP address. /// - [JsonProperty(PropertyName = "publicIpAddress")] - public string PublicIpAddress { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIPAddress {get; set; } /// /// Gets or sets the private IP address. /// - [JsonProperty(PropertyName = "privateIpAddress")] - public string PrivateIpAddress { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIPAddress {get; set; } /// /// Gets or sets the DNS name. /// - [JsonProperty(PropertyName = "dnsName")] - public string DnsName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "dnsName")] + public string DnsName {get; set; } /// - /// Gets or sets the RdpAuthority property is a server DNS host name or - /// IP address followed by the service port number for RDP (Remote - /// Desktop Protocol). + /// Gets or sets the RdpAuthority property is a server DNS host name or IP + /// address followed by the service port number for RDP (Remote Desktop + /// Protocol). /// - [JsonProperty(PropertyName = "rdpAuthority")] - public string RdpAuthority { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "rdpAuthority")] + public string RdpAuthority {get; set; } /// - /// Gets or sets the SshAuthority property is a server DNS host name or - /// IP address followed by the service port number for SSH. + /// Gets or sets the SshAuthority property is a server DNS host name or IP + /// address followed by the service port number for SSH. /// - [JsonProperty(PropertyName = "sshAuthority")] - public string SshAuthority { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sshAuthority")] + public string SshAuthority {get; set; } /// - /// Gets or sets the configuration for sharing a public IP address - /// across multiple virtual machines. + /// Gets or sets the configuration for sharing a public IP address across + /// multiple virtual machines. /// - [JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] - public SharedPublicIpAddressConfiguration SharedPublicIpAddressConfiguration { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SharedPublicIpAddressConfiguration SharedPublicIPAddressConfiguration {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs index e790d77f8f65..4bfdb7a76adc 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class NetworkInterfacePropertiesFragment { /// - /// Initializes a new instance of the - /// NetworkInterfacePropertiesFragment class. + /// Initializes a new instance of the NetworkInterfacePropertiesFragment class. /// public NetworkInterfacePropertiesFragment() { @@ -28,37 +21,50 @@ public NetworkInterfacePropertiesFragment() } /// - /// Initializes a new instance of the - /// NetworkInterfacePropertiesFragment class. + /// Initializes a new instance of the NetworkInterfacePropertiesFragment class. /// - /// The resource ID of the virtual - /// network. - /// The resource ID of the sub net. - /// The resource ID of the public IP - /// address. - /// The public IP address. - /// The private IP address. - /// The DNS name. - /// The RdpAuthority property is a server - /// DNS host name or IP address followed by the service port number for - /// RDP (Remote Desktop Protocol). - /// The SshAuthority property is a server - /// DNS host name or IP address followed by the service port number for - /// SSH. - /// The configuration - /// for sharing a public IP address across multiple virtual - /// machines. - public NetworkInterfacePropertiesFragment(string virtualNetworkId = default(string), string subnetId = default(string), string publicIpAddressId = default(string), string publicIpAddress = default(string), string privateIpAddress = default(string), string dnsName = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), SharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration = default(SharedPublicIpAddressConfigurationFragment)) + + /// The resource ID of the virtual network. + /// + + /// The resource ID of the sub net. + /// + + /// The resource ID of the public IP address. + /// + + /// The public IP address. + /// + + /// The private IP address. + /// + + /// The DNS name. + /// + + /// The RdpAuthority property is a server DNS host name or IP address followed + /// by the service port number for RDP (Remote Desktop Protocol). + /// + + /// The SshAuthority property is a server DNS host name or IP address followed + /// by the service port number for SSH. + /// + + /// The configuration for sharing a public IP address across multiple virtual + /// machines. + /// + public NetworkInterfacePropertiesFragment(string virtualNetworkId = default(string), string subnetId = default(string), string publicIPAddressId = default(string), string publicIPAddress = default(string), string privateIPAddress = default(string), string dnsName = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), SharedPublicIpAddressConfigurationFragment sharedPublicIPAddressConfiguration = default(SharedPublicIpAddressConfigurationFragment)) + { - VirtualNetworkId = virtualNetworkId; - SubnetId = subnetId; - PublicIpAddressId = publicIpAddressId; - PublicIpAddress = publicIpAddress; - PrivateIpAddress = privateIpAddress; - DnsName = dnsName; - RdpAuthority = rdpAuthority; - SshAuthority = sshAuthority; - SharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + this.VirtualNetworkId = virtualNetworkId; + this.SubnetId = subnetId; + this.PublicIPAddressId = publicIPAddressId; + this.PublicIPAddress = publicIPAddress; + this.PrivateIPAddress = privateIPAddress; + this.DnsName = dnsName; + this.RdpAuthority = rdpAuthority; + this.SshAuthority = sshAuthority; + this.SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; CustomInit(); } @@ -67,63 +73,63 @@ public NetworkInterfacePropertiesFragment() /// partial void CustomInit(); + /// /// Gets or sets the resource ID of the virtual network. /// - [JsonProperty(PropertyName = "virtualNetworkId")] - public string VirtualNetworkId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkId")] + public string VirtualNetworkId {get; set; } /// /// Gets or sets the resource ID of the sub net. /// - [JsonProperty(PropertyName = "subnetId")] - public string SubnetId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetId")] + public string SubnetId {get; set; } /// /// Gets or sets the resource ID of the public IP address. /// - [JsonProperty(PropertyName = "publicIpAddressId")] - public string PublicIpAddressId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIpAddressId")] + public string PublicIPAddressId {get; set; } /// /// Gets or sets the public IP address. /// - [JsonProperty(PropertyName = "publicIpAddress")] - public string PublicIpAddress { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIPAddress {get; set; } /// /// Gets or sets the private IP address. /// - [JsonProperty(PropertyName = "privateIpAddress")] - public string PrivateIpAddress { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIPAddress {get; set; } /// /// Gets or sets the DNS name. /// - [JsonProperty(PropertyName = "dnsName")] - public string DnsName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "dnsName")] + public string DnsName {get; set; } /// - /// Gets or sets the RdpAuthority property is a server DNS host name or - /// IP address followed by the service port number for RDP (Remote - /// Desktop Protocol). + /// Gets or sets the RdpAuthority property is a server DNS host name or IP + /// address followed by the service port number for RDP (Remote Desktop + /// Protocol). /// - [JsonProperty(PropertyName = "rdpAuthority")] - public string RdpAuthority { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "rdpAuthority")] + public string RdpAuthority {get; set; } /// - /// Gets or sets the SshAuthority property is a server DNS host name or - /// IP address followed by the service port number for SSH. + /// Gets or sets the SshAuthority property is a server DNS host name or IP + /// address followed by the service port number for SSH. /// - [JsonProperty(PropertyName = "sshAuthority")] - public string SshAuthority { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sshAuthority")] + public string SshAuthority {get; set; } /// - /// Gets or sets the configuration for sharing a public IP address - /// across multiple virtual machines. + /// Gets or sets the configuration for sharing a public IP address across + /// multiple virtual machines. /// - [JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] - public SharedPublicIpAddressConfigurationFragment SharedPublicIpAddressConfiguration { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SharedPublicIpAddressConfigurationFragment SharedPublicIPAddressConfiguration {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs index 17ac4b8e5798..0b21883bf506 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A notification. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class NotificationChannel : Resource { /// @@ -34,31 +24,49 @@ public NotificationChannel() /// /// Initializes a new instance of the NotificationChannel class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The webhook URL to send notifications - /// to. - /// Description of notification. - /// The list of event for which this notification - /// is enabled. - /// The creation date of the notification - /// channel. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public NotificationChannel(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string webHookUrl = default(string), string description = default(string), IList events = default(IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The webhook URL to send notifications to. + /// + + /// Description of notification. + /// + + /// The list of event for which this notification is enabled. + /// + + /// The creation date of the notification channel. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public NotificationChannel(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string webHookUrl = default(string), string description = default(string), System.Collections.Generic.IList events = default(System.Collections.Generic.IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - WebHookUrl = webHookUrl; - Description = description; - Events = events; - CreatedDate = createdDate; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.WebHookUrl = webHookUrl; + this.Description = description; + this.Events = events; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -67,42 +75,41 @@ public NotificationChannel() /// partial void CustomInit(); + /// /// Gets or sets the webhook URL to send notifications to. /// - [JsonProperty(PropertyName = "properties.webHookUrl")] - public string WebHookUrl { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.webHookUrl")] + public string WebHookUrl {get; set; } /// /// Gets or sets description of notification. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// - /// Gets or sets the list of event for which this notification is - /// enabled. + /// Gets or sets the list of event for which this notification is enabled. /// - [JsonProperty(PropertyName = "properties.events")] - public IList Events { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.events")] + public System.Collections.Generic.IList Events {get; set; } /// /// Gets the creation date of the notification channel. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs index abe6a61224b5..bbd575f13ab4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for NotificationChannelEventType. /// + + public static class NotificationChannelEventType { public const string AutoShutdown = "AutoShutdown"; public const string Cost = "Cost"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs index 2e9cc702278c..a49b7e4fbc66 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs @@ -1,31 +1,20 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A notification. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class NotificationChannelFragment : Resource { /// - /// Initializes a new instance of the NotificationChannelFragment - /// class. + /// Initializes a new instance of the NotificationChannelFragment class. /// public NotificationChannelFragment() { @@ -33,31 +22,47 @@ public NotificationChannelFragment() } /// - /// Initializes a new instance of the NotificationChannelFragment - /// class. + /// Initializes a new instance of the NotificationChannelFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The webhook URL to send notifications - /// to. - /// Description of notification. - /// The list of event for which this notification - /// is enabled. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public NotificationChannelFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string webHookUrl = default(string), string description = default(string), IList events = default(IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The webhook URL to send notifications to. + /// + + /// Description of notification. + /// + + /// The list of event for which this notification is enabled. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public NotificationChannelFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string webHookUrl = default(string), string description = default(string), System.Collections.Generic.IList events = default(System.Collections.Generic.IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - WebHookUrl = webHookUrl; - Description = description; - Events = events; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.WebHookUrl = webHookUrl; + this.Description = description; + this.Events = events; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -66,36 +71,35 @@ public NotificationChannelFragment() /// partial void CustomInit(); + /// /// Gets or sets the webhook URL to send notifications to. /// - [JsonProperty(PropertyName = "properties.webHookUrl")] - public string WebHookUrl { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.webHookUrl")] + public string WebHookUrl {get; set; } /// /// Gets or sets description of notification. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// - /// Gets or sets the list of event for which this notification is - /// enabled. + /// Gets or sets the list of event for which this notification is enabled. /// - [JsonProperty(PropertyName = "properties.events")] - public IList Events { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.events")] + public System.Collections.Generic.IList Events {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelProperties.cs new file mode 100644 index 000000000000..bf1b0b85c3d9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedule. + /// + public partial class NotificationChannelProperties + { + /// + /// Initializes a new instance of the NotificationChannelProperties class. + /// + public NotificationChannelProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationChannelProperties class. + /// + + /// The webhook URL to send notifications to. + /// + + /// Description of notification. + /// + + /// The list of event for which this notification is enabled. + /// + + /// The creation date of the notification channel. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public NotificationChannelProperties(string webHookUrl = default(string), string description = default(string), System.Collections.Generic.IList events = default(System.Collections.Generic.IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.WebHookUrl = webHookUrl; + this.Description = description; + this.Events = events; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the webhook URL to send notifications to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "webHookUrl")] + public string WebHookUrl {get; set; } + + /// + /// Gets or sets description of notification. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the list of event for which this notification is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "events")] + public System.Collections.Generic.IList Events {get; set; } + + /// + /// Gets the creation date of the notification channel. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelPropertiesFragment.cs new file mode 100644 index 000000000000..dc51ec48b22a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelPropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedule. + /// + public partial class NotificationChannelPropertiesFragment + { + /// + /// Initializes a new instance of the NotificationChannelPropertiesFragment class. + /// + public NotificationChannelPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationChannelPropertiesFragment class. + /// + + /// The webhook URL to send notifications to. + /// + + /// Description of notification. + /// + + /// The list of event for which this notification is enabled. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public NotificationChannelPropertiesFragment(string webHookUrl = default(string), string description = default(string), System.Collections.Generic.IList events = default(System.Collections.Generic.IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.WebHookUrl = webHookUrl; + this.Description = description; + this.Events = events; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the webhook URL to send notifications to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "webHookUrl")] + public string WebHookUrl {get; set; } + + /// + /// Gets or sets description of notification. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the list of event for which this notification is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "events")] + public System.Collections.Generic.IList Events {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs index 0f278caec20e..e0fb24892023 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,18 +23,21 @@ public NotificationSettings() /// /// Initializes a new instance of the NotificationSettings class. /// - /// If notifications are enabled for this schedule - /// (i.e. Enabled, Disabled). Possible values include: 'Disabled', - /// 'Enabled' - /// Time in minutes before event at which - /// notification will be sent. - /// The webhook URL to which the notification - /// will be sent. + + /// If notifications are enabled for this schedule (i.e. Enabled, Disabled). + /// Possible values include: 'Disabled', 'Enabled' + + /// Time in minutes before event at which notification will be sent. + /// + + /// The webhook URL to which the notification will be sent. + /// public NotificationSettings(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string)) + { - Status = status; - TimeInMinutes = timeInMinutes; - WebhookUrl = webhookUrl; + this.Status = status; + this.TimeInMinutes = timeInMinutes; + this.WebhookUrl = webhookUrl; CustomInit(); } @@ -49,26 +46,25 @@ public NotificationSettings() /// partial void CustomInit(); - /// - /// Gets or sets if notifications are enabled for this schedule (i.e. - /// Enabled, Disabled). Possible values include: 'Disabled', 'Enabled' - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } /// - /// Gets or sets time in minutes before event at which notification - /// will be sent. + /// Gets or sets if notifications are enabled for this schedule (i.e. Enabled, + /// Disabled). Possible values include: 'Disabled', 'Enabled' /// - [JsonProperty(PropertyName = "timeInMinutes")] - public int? TimeInMinutes { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// - /// Gets or sets the webhook URL to which the notification will be + /// Gets or sets time in minutes before event at which notification will be /// sent. /// - [JsonProperty(PropertyName = "webhookUrl")] - public string WebhookUrl { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeInMinutes")] + public int? TimeInMinutes {get; set; } + /// + /// Gets or sets the webhook URL to which the notification will be sent. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "webhookUrl")] + public string WebhookUrl {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs index e99c931288ce..dbfff46f87ce 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class NotificationSettingsFragment { /// - /// Initializes a new instance of the NotificationSettingsFragment - /// class. + /// Initializes a new instance of the NotificationSettingsFragment class. /// public NotificationSettingsFragment() { @@ -28,21 +21,23 @@ public NotificationSettingsFragment() } /// - /// Initializes a new instance of the NotificationSettingsFragment - /// class. + /// Initializes a new instance of the NotificationSettingsFragment class. /// - /// If notifications are enabled for this schedule - /// (i.e. Enabled, Disabled). Possible values include: 'Disabled', - /// 'Enabled' - /// Time in minutes before event at which - /// notification will be sent. - /// The webhook URL to which the notification - /// will be sent. + + /// If notifications are enabled for this schedule (i.e. Enabled, Disabled). + /// Possible values include: 'Disabled', 'Enabled' + + /// Time in minutes before event at which notification will be sent. + /// + + /// The webhook URL to which the notification will be sent. + /// public NotificationSettingsFragment(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string)) + { - Status = status; - TimeInMinutes = timeInMinutes; - WebhookUrl = webhookUrl; + this.Status = status; + this.TimeInMinutes = timeInMinutes; + this.WebhookUrl = webhookUrl; CustomInit(); } @@ -51,26 +46,25 @@ public NotificationSettingsFragment() /// partial void CustomInit(); - /// - /// Gets or sets if notifications are enabled for this schedule (i.e. - /// Enabled, Disabled). Possible values include: 'Disabled', 'Enabled' - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } /// - /// Gets or sets time in minutes before event at which notification - /// will be sent. + /// Gets or sets if notifications are enabled for this schedule (i.e. Enabled, + /// Disabled). Possible values include: 'Disabled', 'Enabled' /// - [JsonProperty(PropertyName = "timeInMinutes")] - public int? TimeInMinutes { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// - /// Gets or sets the webhook URL to which the notification will be + /// Gets or sets time in minutes before event at which notification will be /// sent. /// - [JsonProperty(PropertyName = "webhookUrl")] - public string WebhookUrl { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeInMinutes")] + public int? TimeInMinutes {get; set; } + /// + /// Gets or sets the webhook URL to which the notification will be sent. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "webhookUrl")] + public string WebhookUrl {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs index ca1802b8d9aa..5122c4032625 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for NotificationStatus. /// + + public static class NotificationStatus { public const string Disabled = "Disabled"; public const string Enabled = "Enabled"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs index 973474b1ece8..ce49888fd808 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,17 @@ public NotifyParameters() /// /// Initializes a new instance of the NotifyParameters class. /// - /// The type of event (i.e. AutoShutdown, - /// Cost). Possible values include: 'AutoShutdown', 'Cost' - /// Properties for the notification in json - /// format. + + /// The type of event (i.e. AutoShutdown, Cost) + /// Possible values include: 'AutoShutdown', 'Cost' + + /// Properties for the notification in json format. + /// public NotifyParameters(string eventName = default(string), string jsonPayload = default(string)) + { - EventName = eventName; - JsonPayload = jsonPayload; + this.EventName = eventName; + this.JsonPayload = jsonPayload; CustomInit(); } @@ -45,18 +42,17 @@ public NotifyParameters() /// partial void CustomInit(); + /// - /// Gets or sets the type of event (i.e. AutoShutdown, Cost). Possible - /// values include: 'AutoShutdown', 'Cost' + /// Gets or sets the type of event (i.e. AutoShutdown, Cost) Possible values include: 'AutoShutdown', 'Cost' /// - [JsonProperty(PropertyName = "eventName")] - public string EventName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "eventName")] + public string EventName {get; set; } /// /// Gets or sets properties for the notification in json format. /// - [JsonProperty(PropertyName = "jsonPayload")] - public string JsonPayload { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "jsonPayload")] + public string JsonPayload {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs index 7fd87aa1d96c..430e5b266635 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,13 +23,17 @@ public OperationError() /// /// Initializes a new instance of the OperationError class. /// - /// The error code of the operation error. - /// The error message of the operation - /// error. + + /// The error code of the operation error. + /// + + /// The error message of the operation error. + /// public OperationError(string code = default(string), string message = default(string)) + { - Code = code; - Message = message; + this.Code = code; + this.Message = message; CustomInit(); } @@ -44,17 +42,17 @@ public OperationError() /// partial void CustomInit(); + /// /// Gets or sets the error code of the operation error. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } /// /// Gets or sets the error message of the operation error. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs index 8a637cbc3dde..7aa67649a8e4 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,17 @@ public OperationMetadata() /// /// Initializes a new instance of the OperationMetadata class. /// - /// Operation name: - /// {provider}/{resource}/{operation} - /// The object that describes the - /// operations + + /// Operation name: {provider}/{resource}/{operation} + /// + + /// The object that describes the operations + /// public OperationMetadata(string name = default(string), OperationMetadataDisplay display = default(OperationMetadataDisplay)) + { - Name = name; - Display = display; + this.Name = name; + this.Display = display; CustomInit(); } @@ -45,17 +42,17 @@ public OperationMetadata() /// partial void CustomInit(); + /// /// Gets or sets operation name: {provider}/{resource}/{operation} /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets the object that describes the operations /// - [JsonProperty(PropertyName = "display")] - public OperationMetadataDisplay Display { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public OperationMetadataDisplay Display {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs index 98bae28c96c3..c37892758b8f 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,19 +23,25 @@ public OperationMetadataDisplay() /// /// Initializes a new instance of the OperationMetadataDisplay class. /// - /// Friendly name of the resource - /// provider - /// Resource type on which the operation is - /// performed. - /// Operation type: read, write, delete, - /// listKeys/action, etc. - /// Friendly name of the operation + + /// Friendly name of the resource provider + /// + + /// Resource type on which the operation is performed. + /// + + /// Operation type: read, write, delete, listKeys/action, etc. + /// + + /// Friendly name of the operation + /// public OperationMetadataDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { - Provider = provider; - Resource = resource; - Operation = operation; - Description = description; + this.Provider = provider; + this.Resource = resource; + this.Operation = operation; + this.Description = description; CustomInit(); } @@ -50,30 +50,29 @@ public OperationMetadataDisplay() /// partial void CustomInit(); + /// /// Gets or sets friendly name of the resource provider /// - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; set; } /// /// Gets or sets resource type on which the operation is performed. /// - [JsonProperty(PropertyName = "resource")] - public string Resource { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; set; } /// - /// Gets or sets operation type: read, write, delete, listKeys/action, - /// etc. + /// Gets or sets operation type: read, write, delete, listKeys/action, etc. /// - [JsonProperty(PropertyName = "operation")] - public string Operation { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; set; } /// /// Gets or sets friendly name of the operation /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs index 7b0099cbe817..b0d375b52b68 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,28 +23,32 @@ public OperationResult() /// /// Initializes a new instance of the OperationResult class. /// - /// The operation status. + + /// The operation status. + /// + /// The status code for the operation. - /// Possible values include: 'Continue', 'SwitchingProtocols', 'OK', - /// 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', - /// 'ResetContent', 'PartialContent', 'MultipleChoices', - /// 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', - /// 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', - /// 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', - /// 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', - /// 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', - /// 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', - /// 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', - /// 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', - /// 'NotImplemented', 'BadGateway', 'ServiceUnavailable', - /// 'GatewayTimeout', 'HttpVersionNotSupported' - /// Error details for the operation in case of a - /// failure. + /// Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', + /// 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', + /// 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', + /// 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', + /// 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', + /// 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', + /// 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', + /// 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', + /// 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', + /// 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', + /// 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', + /// 'HttpVersionNotSupported' + + /// Error details for the operation in case of a failure. + /// public OperationResult(string status = default(string), string statusCode = default(string), OperationError error = default(OperationError)) + { - Status = status; - StatusCode = statusCode; - Error = error; + this.Status = status; + this.StatusCode = statusCode; + this.Error = error; CustomInit(); } @@ -59,36 +57,23 @@ public OperationResult() /// partial void CustomInit(); + /// /// Gets or sets the operation status. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// - /// Gets or sets the status code for the operation. Possible values - /// include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', - /// 'Accepted', 'NonAuthoritativeInformation', 'NoContent', - /// 'ResetContent', 'PartialContent', 'MultipleChoices', - /// 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', - /// 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', - /// 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', - /// 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', - /// 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', - /// 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', - /// 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', - /// 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', - /// 'NotImplemented', 'BadGateway', 'ServiceUnavailable', - /// 'GatewayTimeout', 'HttpVersionNotSupported' + /// Gets or sets the status code for the operation. Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HttpVersionNotSupported' /// - [JsonProperty(PropertyName = "statusCode")] - public string StatusCode { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "statusCode")] + public string StatusCode {get; set; } /// /// Gets or sets error details for the operation in case of a failure. /// - [JsonProperty(PropertyName = "error")] - public OperationError Error { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public OperationError Error {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs index 132d59834ce1..f202354a7ece 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs @@ -1,53 +1,43 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + namespace Microsoft.Azure.Management.DevTestLabs.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 + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.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(); - } + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.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 System.Collections.Generic.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. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs index 2a030f059c37..699195fbd9d6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs @@ -1,20 +1,14 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// - /// Information about an artifact's parameter. + /// Information about an artifact's parameter. /// public partial class ParameterInfo { @@ -29,12 +23,17 @@ public ParameterInfo() /// /// Initializes a new instance of the ParameterInfo class. /// - /// The name of the artifact parameter. - /// The value of the artifact parameter. + + /// The name of the artifact parameter. + /// + + /// The value of the artifact parameter. + /// public ParameterInfo(string name = default(string), string value = default(string)) + { - Name = name; - Value = value; + this.Name = name; + this.Value = value; CustomInit(); } @@ -43,17 +42,17 @@ public ParameterInfo() /// partial void CustomInit(); + /// /// Gets or sets the name of the artifact parameter. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets the value of the artifact parameter. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs index 6db9a1fe0248..443d1e3c3685 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,17 @@ public ParametersValueFileInfo() /// /// Initializes a new instance of the ParametersValueFileInfo class. /// - /// File name. - /// Contents of the file. + + /// File name. + /// + + /// Contents of the file. + /// public ParametersValueFileInfo(string fileName = default(string), object parametersValueInfo = default(object)) + { - FileName = fileName; - ParametersValueInfo = parametersValueInfo; + this.FileName = fileName; + this.ParametersValueInfo = parametersValueInfo; CustomInit(); } @@ -43,17 +42,17 @@ public ParametersValueFileInfo() /// partial void CustomInit(); + /// /// Gets or sets file name. /// - [JsonProperty(PropertyName = "fileName")] - public string FileName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "fileName")] + public string FileName {get; set; } /// /// Gets or sets contents of the file. /// - [JsonProperty(PropertyName = "parametersValueInfo")] - public object ParametersValueInfo { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "parametersValueInfo")] + public object ParametersValueInfo {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs index 8e3bb0efb8c3..283778490333 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class PercentageCostThresholdProperties { /// - /// Initializes a new instance of the PercentageCostThresholdProperties - /// class. + /// Initializes a new instance of the PercentageCostThresholdProperties class. /// public PercentageCostThresholdProperties() { @@ -28,13 +21,15 @@ public PercentageCostThresholdProperties() } /// - /// Initializes a new instance of the PercentageCostThresholdProperties - /// class. + /// Initializes a new instance of the PercentageCostThresholdProperties class. /// - /// The cost threshold value. + + /// The cost threshold value. + /// public PercentageCostThresholdProperties(double? thresholdValue = default(double?)) + { - ThresholdValue = thresholdValue; + this.ThresholdValue = thresholdValue; CustomInit(); } @@ -43,11 +38,11 @@ public PercentageCostThresholdProperties() /// partial void CustomInit(); + /// /// Gets or sets the cost threshold value. /// - [JsonProperty(PropertyName = "thresholdValue")] - public double? ThresholdValue { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "thresholdValue")] + public double? ThresholdValue {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs index f7b7d259d107..c6fce4446f91 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A Policy. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Policy : Resource { /// @@ -34,43 +24,66 @@ public Policy() /// /// Initializes a new instance of the Policy class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The description of the policy. - /// The status of the policy. Possible values - /// include: 'Enabled', 'Disabled' - /// The fact name of the policy (e.g. - /// LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values - /// include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', - /// 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', - /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' - /// The fact data of the policy. - /// The threshold of the policy (i.e. a number - /// for MaxValuePolicy, and a JSON array of values for - /// AllowedValuesPolicy). - /// The evaluator type of the policy (i.e. - /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: - /// 'AllowedValuesPolicy', 'MaxValuePolicy' - /// The creation date of the policy. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public Policy(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The description of the policy. + /// + + /// The status of the policy. + /// Possible values include: 'Enabled', 'Disabled' + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. + /// Possible values include: 'UserOwnedLabVmCount', + /// 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', + /// 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + + /// The fact data of the policy. + /// + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + /// array of values for AllowedValuesPolicy). + /// + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). + /// Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + + /// The creation date of the policy. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Policy(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Description = description; - Status = status; - FactName = factName; - FactData = factData; - Threshold = threshold; - EvaluatorType = evaluatorType; - CreatedDate = createdDate; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.Description = description; + this.Status = status; + this.FactName = factName; + this.FactData = factData; + this.Threshold = threshold; + this.EvaluatorType = evaluatorType; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -79,68 +92,62 @@ public Policy() /// partial void CustomInit(); + /// /// Gets or sets the description of the policy. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// - /// Gets or sets the status of the policy. Possible values include: - /// 'Enabled', 'Disabled' + /// Gets or sets the status of the policy. Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// - /// Gets or sets the fact name of the policy (e.g. LabVmCount, - /// LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: - /// 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', - /// 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', - /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + /// Gets or sets the fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' /// - [JsonProperty(PropertyName = "properties.factName")] - public string FactName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.factName")] + public string FactName {get; set; } /// /// Gets or sets the fact data of the policy. /// - [JsonProperty(PropertyName = "properties.factData")] - public string FactData { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.factData")] + public string FactData {get; set; } /// - /// Gets or sets the threshold of the policy (i.e. a number for - /// MaxValuePolicy, and a JSON array of values for - /// AllowedValuesPolicy). + /// Gets or sets the threshold of the policy (i.e. a number for MaxValuePolicy, + /// and a JSON array of values for AllowedValuesPolicy). /// - [JsonProperty(PropertyName = "properties.threshold")] - public string Threshold { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.threshold")] + public string Threshold {get; set; } /// - /// Gets or sets the evaluator type of the policy (i.e. - /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: - /// 'AllowedValuesPolicy', 'MaxValuePolicy' + /// Gets or sets the evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' /// - [JsonProperty(PropertyName = "properties.evaluatorType")] - public string EvaluatorType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.evaluatorType")] + public string EvaluatorType {get; set; } /// /// Gets the creation date of the policy. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs index a4eb10ab44f0..6c8fcc602ffd 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for PolicyEvaluatorType. /// + + public static class PolicyEvaluatorType { public const string AllowedValuesPolicy = "AllowedValuesPolicy"; public const string MaxValuePolicy = "MaxValuePolicy"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs index 6c528e2d86f2..2ebafb70a263 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for PolicyFactName. /// + + public static class PolicyFactName { public const string UserOwnedLabVmCount = "UserOwnedLabVmCount"; @@ -25,4 +22,4 @@ public static class PolicyFactName public const string UserOwnedLabVmCountInSubnet = "UserOwnedLabVmCountInSubnet"; public const string LabTargetCost = "LabTargetCost"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs index e70b9de2384c..61558eda2e0c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A Policy. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class PolicyFragment : Resource { /// @@ -34,41 +24,62 @@ public PolicyFragment() /// /// Initializes a new instance of the PolicyFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The description of the policy. - /// The status of the policy. Possible values - /// include: 'Enabled', 'Disabled' - /// The fact name of the policy (e.g. - /// LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values - /// include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', - /// 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', - /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' - /// The fact data of the policy. - /// The threshold of the policy (i.e. a number - /// for MaxValuePolicy, and a JSON array of values for - /// AllowedValuesPolicy). - /// The evaluator type of the policy (i.e. - /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: - /// 'AllowedValuesPolicy', 'MaxValuePolicy' - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public PolicyFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The description of the policy. + /// + + /// The status of the policy. + /// Possible values include: 'Enabled', 'Disabled' + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. + /// Possible values include: 'UserOwnedLabVmCount', + /// 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', + /// 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + + /// The fact data of the policy. + /// + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + /// array of values for AllowedValuesPolicy). + /// + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). + /// Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public PolicyFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Description = description; - Status = status; - FactName = factName; - FactData = factData; - Threshold = threshold; - EvaluatorType = evaluatorType; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.Description = description; + this.Status = status; + this.FactName = factName; + this.FactData = factData; + this.Threshold = threshold; + this.EvaluatorType = evaluatorType; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -77,62 +88,56 @@ public PolicyFragment() /// partial void CustomInit(); + /// /// Gets or sets the description of the policy. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// - /// Gets or sets the status of the policy. Possible values include: - /// 'Enabled', 'Disabled' + /// Gets or sets the status of the policy. Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// - /// Gets or sets the fact name of the policy (e.g. LabVmCount, - /// LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: - /// 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', - /// 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', - /// 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + /// Gets or sets the fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' /// - [JsonProperty(PropertyName = "properties.factName")] - public string FactName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.factName")] + public string FactName {get; set; } /// /// Gets or sets the fact data of the policy. /// - [JsonProperty(PropertyName = "properties.factData")] - public string FactData { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.factData")] + public string FactData {get; set; } /// - /// Gets or sets the threshold of the policy (i.e. a number for - /// MaxValuePolicy, and a JSON array of values for - /// AllowedValuesPolicy). + /// Gets or sets the threshold of the policy (i.e. a number for MaxValuePolicy, + /// and a JSON array of values for AllowedValuesPolicy). /// - [JsonProperty(PropertyName = "properties.threshold")] - public string Threshold { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.threshold")] + public string Threshold {get; set; } /// - /// Gets or sets the evaluator type of the policy (i.e. - /// AllowedValuesPolicy, MaxValuePolicy). Possible values include: - /// 'AllowedValuesPolicy', 'MaxValuePolicy' + /// Gets or sets the evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' /// - [JsonProperty(PropertyName = "properties.evaluatorType")] - public string EvaluatorType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.evaluatorType")] + public string EvaluatorType {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyProperties.cs new file mode 100644 index 000000000000..428b3a6ce689 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a Policy. + /// + public partial class PolicyProperties + { + /// + /// Initializes a new instance of the PolicyProperties class. + /// + public PolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyProperties class. + /// + + /// The description of the policy. + /// + + /// The status of the policy. + /// Possible values include: 'Enabled', 'Disabled' + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. + /// Possible values include: 'UserOwnedLabVmCount', + /// 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', + /// 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + + /// The fact data of the policy. + /// + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + /// array of values for AllowedValuesPolicy). + /// + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). + /// Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + + /// The creation date of the policy. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public PolicyProperties(string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Description = description; + this.Status = status; + this.FactName = factName; + this.FactData = factData; + this.Threshold = threshold; + this.EvaluatorType = evaluatorType; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the status of the policy. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factName")] + public string FactName {get; set; } + + /// + /// Gets or sets the fact data of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factData")] + public string FactData {get; set; } + + /// + /// Gets or sets the threshold of the policy (i.e. a number for MaxValuePolicy, + /// and a JSON array of values for AllowedValuesPolicy). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "threshold")] + public string Threshold {get; set; } + + /// + /// Gets or sets the evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "evaluatorType")] + public string EvaluatorType {get; set; } + + /// + /// Gets the creation date of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyPropertiesFragment.cs new file mode 100644 index 000000000000..e5c3d7e2c685 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyPropertiesFragment.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a Policy. + /// + public partial class PolicyPropertiesFragment + { + /// + /// Initializes a new instance of the PolicyPropertiesFragment class. + /// + public PolicyPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyPropertiesFragment class. + /// + + /// The description of the policy. + /// + + /// The status of the policy. + /// Possible values include: 'Enabled', 'Disabled' + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. + /// Possible values include: 'UserOwnedLabVmCount', + /// 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', + /// 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + + /// The fact data of the policy. + /// + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + /// array of values for AllowedValuesPolicy). + /// + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). + /// Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public PolicyPropertiesFragment(string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Description = description; + this.Status = status; + this.FactName = factName; + this.FactData = factData; + this.Threshold = threshold; + this.EvaluatorType = evaluatorType; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the status of the policy. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factName")] + public string FactName {get; set; } + + /// + /// Gets or sets the fact data of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factData")] + public string FactData {get; set; } + + /// + /// Gets or sets the threshold of the policy (i.e. a number for MaxValuePolicy, + /// and a JSON array of values for AllowedValuesPolicy). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "threshold")] + public string Threshold {get; set; } + + /// + /// Gets or sets the evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "evaluatorType")] + public string EvaluatorType {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs index d4ce94a02670..8372cdc5ae24 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,14 +23,18 @@ public PolicySetResult() /// /// Initializes a new instance of the PolicySetResult class. /// - /// A value indicating whether this policy set - /// evaluation has discovered violations. - /// The list of policy - /// violations. - public PolicySetResult(bool? hasError = default(bool?), IList policyViolations = default(IList)) + + /// A value indicating whether this policy set evaluation has discovered + /// violations. + /// + + /// The list of policy violations. + /// + public PolicySetResult(bool? hasError = default(bool?), System.Collections.Generic.IList policyViolations = default(System.Collections.Generic.IList)) + { - HasError = hasError; - PolicyViolations = policyViolations; + this.HasError = hasError; + this.PolicyViolations = policyViolations; CustomInit(); } @@ -47,18 +43,18 @@ public PolicySetResult() /// partial void CustomInit(); + /// - /// Gets or sets a value indicating whether this policy set evaluation - /// has discovered violations. + /// Gets or sets a value indicating whether this policy set evaluation has + /// discovered violations. /// - [JsonProperty(PropertyName = "hasError")] - public bool? HasError { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "hasError")] + public bool? HasError {get; set; } /// /// Gets or sets the list of policy violations. /// - [JsonProperty(PropertyName = "policyViolations")] - public IList PolicyViolations { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "policyViolations")] + public System.Collections.Generic.IList PolicyViolations {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs index be2760e1856e..a11d6aa3cf93 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for PolicyStatus. /// + + public static class PolicyStatus { public const string Enabled = "Enabled"; public const string Disabled = "Disabled"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs index a2dcac6def61..371b7a0e1442 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,17 @@ public PolicyViolation() /// /// Initializes a new instance of the PolicyViolation class. /// - /// The code of the policy violation. - /// The message of the policy violation. + + /// The code of the policy violation. + /// + + /// The message of the policy violation. + /// public PolicyViolation(string code = default(string), string message = default(string)) + { - Code = code; - Message = message; + this.Code = code; + this.Message = message; CustomInit(); } @@ -43,17 +42,17 @@ public PolicyViolation() /// partial void CustomInit(); + /// /// Gets or sets the code of the policy violation. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } /// /// Gets or sets the message of the policy violation. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs index 952dfaa69635..c630eea6e2dc 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,17 @@ public Port() /// /// Initializes a new instance of the Port class. /// - /// Protocol type of the port. Possible - /// values include: 'Tcp', 'Udp' - /// Backend port of the target virtual - /// machine. + + /// Protocol type of the port. + /// Possible values include: 'Tcp', 'Udp' + + /// Backend port of the target virtual machine. + /// public Port(string transportProtocol = default(string), int? backendPort = default(int?)) + { - TransportProtocol = transportProtocol; - BackendPort = backendPort; + this.TransportProtocol = transportProtocol; + this.BackendPort = backendPort; CustomInit(); } @@ -45,18 +42,17 @@ public Port() /// partial void CustomInit(); + /// - /// Gets or sets protocol type of the port. Possible values include: - /// 'Tcp', 'Udp' + /// Gets or sets protocol type of the port. Possible values include: 'Tcp', 'Udp' /// - [JsonProperty(PropertyName = "transportProtocol")] - public string TransportProtocol { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol {get; set; } /// /// Gets or sets backend port of the target virtual machine. /// - [JsonProperty(PropertyName = "backendPort")] - public int? BackendPort { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int? BackendPort {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs index ccf98f72fa22..365e29c006b1 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,17 @@ public PortFragment() /// /// Initializes a new instance of the PortFragment class. /// - /// Protocol type of the port. Possible - /// values include: 'Tcp', 'Udp' - /// Backend port of the target virtual - /// machine. + + /// Protocol type of the port. + /// Possible values include: 'Tcp', 'Udp' + + /// Backend port of the target virtual machine. + /// public PortFragment(string transportProtocol = default(string), int? backendPort = default(int?)) + { - TransportProtocol = transportProtocol; - BackendPort = backendPort; + this.TransportProtocol = transportProtocol; + this.BackendPort = backendPort; CustomInit(); } @@ -45,18 +42,17 @@ public PortFragment() /// partial void CustomInit(); + /// - /// Gets or sets protocol type of the port. Possible values include: - /// 'Tcp', 'Udp' + /// Gets or sets protocol type of the port. Possible values include: 'Tcp', 'Udp' /// - [JsonProperty(PropertyName = "transportProtocol")] - public string TransportProtocol { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol {get; set; } /// /// Gets or sets backend port of the target virtual machine. /// - [JsonProperty(PropertyName = "backendPort")] - public int? BackendPort { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int? BackendPort {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs index 93be3e948363..92e300364695 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for PremiumDataDisk. /// + + public static class PremiumDataDisk { public const string Disabled = "Disabled"; public const string Enabled = "Enabled"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs index d4b5a9a92876..03e0b6fb31df 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for ReportingCycleType. /// + + public static class ReportingCycleType { public const string CalendarMonth = "CalendarMonth"; public const string Custom = "Custom"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs index 065a5d37a329..2319efe74553 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// An Azure resource. /// - public partial class Resource : IResource + public partial class Resource : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the Resource class. @@ -33,18 +23,29 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + { - Id = id; - Name = name; - Type = type; - Location = location; - Tags = tags; + this.Id = id; + this.Name = name; + this.Type = type; + this.Location = location; + this.Tags = tags; CustomInit(); } @@ -53,35 +54,35 @@ public Resource() /// partial void CustomInit(); + /// /// Gets the identifier of the resource. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets the name of the resource. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets the type of the resource. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } /// /// Gets or sets the location of the resource. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } /// /// Gets or sets the tags of the resource. /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs index dc97ef5917aa..8fd8de30b827 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,18 @@ public RetargetScheduleProperties() /// /// Initializes a new instance of the RetargetScheduleProperties class. /// - /// The resource Id of the virtual - /// machine on which the schedule operates - /// The resource Id of the virtual - /// machine that the schedule should be retargeted to + + /// The resource Id of the virtual machine on which the schedule operates + /// + + /// The resource Id of the virtual machine that the schedule should be + /// retargeted to + /// public RetargetScheduleProperties(string currentResourceId = default(string), string targetResourceId = default(string)) + { - CurrentResourceId = currentResourceId; - TargetResourceId = targetResourceId; + this.CurrentResourceId = currentResourceId; + this.TargetResourceId = targetResourceId; CustomInit(); } @@ -45,19 +43,19 @@ public RetargetScheduleProperties() /// partial void CustomInit(); + /// - /// Gets or sets the resource Id of the virtual machine on which the - /// schedule operates + /// Gets or sets the resource Id of the virtual machine on which the schedule + /// operates /// - [JsonProperty(PropertyName = "currentResourceId")] - public string CurrentResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "currentResourceId")] + public string CurrentResourceId {get; set; } /// - /// Gets or sets the resource Id of the virtual machine that the - /// schedule should be retargeted to + /// Gets or sets the resource Id of the virtual machine that the schedule + /// should be retargeted to /// - [JsonProperty(PropertyName = "targetResourceId")] - public string TargetResourceId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceId")] + public string TargetResourceId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs index dbf967b4cf3a..5519392b30f0 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A schedule. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Schedule : Resource { /// @@ -34,46 +24,72 @@ public Schedule() /// /// Initializes a new instance of the Schedule class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The status of the schedule (i.e. Enabled, - /// Disabled). Possible values include: 'Enabled', 'Disabled' - /// The task type of the schedule (e.g. - /// LabVmsShutdownTask, LabVmAutoStart). - /// If the schedule will occur only some - /// days of the week, specify the weekly recurrence. - /// If the schedule will occur once each - /// day of the week, specify the daily recurrence. - /// If the schedule will occur multiple - /// times a day, specify the hourly recurrence. - /// The time zone ID (e.g. Pacific Standard - /// time). - /// Notification settings. - /// The creation date of the - /// schedule. - /// The resource ID to which the - /// schedule belongs - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public Schedule(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), NotificationSettings notificationSettings = default(NotificationSettings), System.DateTime? createdDate = default(System.DateTime?), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// Notification settings. + /// + + /// The status of the schedule (i.e. Enabled, Disabled) + /// Possible values include: 'Enabled', 'Disabled' + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// + + /// If the schedule will occur only some days of the week, specify the weekly + /// recurrence. + /// + + /// If the schedule will occur once each day of the week, specify the daily + /// recurrence. + /// + + /// If the schedule will occur multiple times a day, specify the hourly + /// recurrence. + /// + + /// The time zone ID (e.g. Pacific Standard time). + /// + + /// The creation date of the schedule. + /// + + /// The resource ID to which the schedule belongs + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Schedule(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), NotificationSettings notificationSettings = default(NotificationSettings), string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), System.DateTime? createdDate = default(System.DateTime?), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Status = status; - TaskType = taskType; - WeeklyRecurrence = weeklyRecurrence; - DailyRecurrence = dailyRecurrence; - HourlyRecurrence = hourlyRecurrence; - TimeZoneId = timeZoneId; - NotificationSettings = notificationSettings; - CreatedDate = createdDate; - TargetResourceId = targetResourceId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.NotificationSettings = notificationSettings; + this.Status = status; + this.TaskType = taskType; + this.WeeklyRecurrence = weeklyRecurrence; + this.DailyRecurrence = dailyRecurrence; + this.HourlyRecurrence = hourlyRecurrence; + this.TimeZoneId = timeZoneId; + this.CreatedDate = createdDate; + this.TargetResourceId = targetResourceId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -82,76 +98,75 @@ public Schedule() /// partial void CustomInit(); + /// - /// Gets or sets the status of the schedule (i.e. Enabled, Disabled). - /// Possible values include: 'Enabled', 'Disabled' + /// Gets or sets notification settings. /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettings NotificationSettings {get; set; } /// - /// Gets or sets the task type of the schedule (e.g. - /// LabVmsShutdownTask, LabVmAutoStart). + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled) Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "properties.taskType")] - public string TaskType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// - /// Gets or sets if the schedule will occur only some days of the week, - /// specify the weekly recurrence. + /// Gets or sets the task type of the schedule (e.g. LabVmsShutdownTask, + /// LabVmAutoStart). /// - [JsonProperty(PropertyName = "properties.weeklyRecurrence")] - public WeekDetails WeeklyRecurrence { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.taskType")] + public string TaskType {get; set; } /// - /// Gets or sets if the schedule will occur once each day of the week, - /// specify the daily recurrence. + /// Gets or sets if the schedule will occur only some days of the week, specify + /// the weekly recurrence. /// - [JsonProperty(PropertyName = "properties.dailyRecurrence")] - public DayDetails DailyRecurrence { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.weeklyRecurrence")] + public WeekDetails WeeklyRecurrence {get; set; } /// - /// Gets or sets if the schedule will occur multiple times a day, - /// specify the hourly recurrence. + /// Gets or sets if the schedule will occur once each day of the week, specify + /// the daily recurrence. /// - [JsonProperty(PropertyName = "properties.hourlyRecurrence")] - public HourDetails HourlyRecurrence { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dailyRecurrence")] + public DayDetails DailyRecurrence {get; set; } /// - /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// Gets or sets if the schedule will occur multiple times a day, specify the + /// hourly recurrence. /// - [JsonProperty(PropertyName = "properties.timeZoneId")] - public string TimeZoneId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hourlyRecurrence")] + public HourDetails HourlyRecurrence {get; set; } /// - /// Gets or sets notification settings. + /// Gets or sets the time zone ID (e.g. Pacific Standard time). /// - [JsonProperty(PropertyName = "properties.notificationSettings")] - public NotificationSettings NotificationSettings { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId {get; set; } /// /// Gets the creation date of the schedule. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets or sets the resource ID to which the schedule belongs /// - [JsonProperty(PropertyName = "properties.targetResourceId")] - public string TargetResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceId")] + public string TargetResourceId {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs index 44431e77725f..27f0f9fc9723 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A schedule. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class ScheduleFragment : Resource { /// @@ -34,43 +24,68 @@ public ScheduleFragment() /// /// Initializes a new instance of the ScheduleFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The status of the schedule (i.e. Enabled, - /// Disabled). Possible values include: 'Enabled', 'Disabled' - /// The task type of the schedule (e.g. - /// LabVmsShutdownTask, LabVmAutoStart). - /// If the schedule will occur only some - /// days of the week, specify the weekly recurrence. - /// If the schedule will occur once each - /// day of the week, specify the daily recurrence. - /// If the schedule will occur multiple - /// times a day, specify the hourly recurrence. - /// The time zone ID (e.g. Pacific Standard - /// time). - /// Notification settings. - /// The resource ID to which the - /// schedule belongs - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public ScheduleFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The status of the schedule (i.e. Enabled, Disabled) + /// Possible values include: 'Enabled', 'Disabled' + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// + + /// If the schedule will occur only some days of the week, specify the weekly + /// recurrence. + /// + + /// If the schedule will occur once each day of the week, specify the daily + /// recurrence. + /// + + /// If the schedule will occur multiple times a day, specify the hourly + /// recurrence. + /// + + /// The time zone ID (e.g. Pacific Standard time). + /// + + /// Notification settings. + /// + + /// The resource ID to which the schedule belongs + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ScheduleFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Status = status; - TaskType = taskType; - WeeklyRecurrence = weeklyRecurrence; - DailyRecurrence = dailyRecurrence; - HourlyRecurrence = hourlyRecurrence; - TimeZoneId = timeZoneId; - NotificationSettings = notificationSettings; - TargetResourceId = targetResourceId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.Status = status; + this.TaskType = taskType; + this.WeeklyRecurrence = weeklyRecurrence; + this.DailyRecurrence = dailyRecurrence; + this.HourlyRecurrence = hourlyRecurrence; + this.TimeZoneId = timeZoneId; + this.NotificationSettings = notificationSettings; + this.TargetResourceId = targetResourceId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -79,70 +94,69 @@ public ScheduleFragment() /// partial void CustomInit(); + /// - /// Gets or sets the status of the schedule (i.e. Enabled, Disabled). - /// Possible values include: 'Enabled', 'Disabled' + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled) Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// - /// Gets or sets the task type of the schedule (e.g. - /// LabVmsShutdownTask, LabVmAutoStart). + /// Gets or sets the task type of the schedule (e.g. LabVmsShutdownTask, + /// LabVmAutoStart). /// - [JsonProperty(PropertyName = "properties.taskType")] - public string TaskType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.taskType")] + public string TaskType {get; set; } /// - /// Gets or sets if the schedule will occur only some days of the week, - /// specify the weekly recurrence. + /// Gets or sets if the schedule will occur only some days of the week, specify + /// the weekly recurrence. /// - [JsonProperty(PropertyName = "properties.weeklyRecurrence")] - public WeekDetailsFragment WeeklyRecurrence { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.weeklyRecurrence")] + public WeekDetailsFragment WeeklyRecurrence {get; set; } /// - /// Gets or sets if the schedule will occur once each day of the week, - /// specify the daily recurrence. + /// Gets or sets if the schedule will occur once each day of the week, specify + /// the daily recurrence. /// - [JsonProperty(PropertyName = "properties.dailyRecurrence")] - public DayDetailsFragment DailyRecurrence { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dailyRecurrence")] + public DayDetailsFragment DailyRecurrence {get; set; } /// - /// Gets or sets if the schedule will occur multiple times a day, - /// specify the hourly recurrence. + /// Gets or sets if the schedule will occur multiple times a day, specify the + /// hourly recurrence. /// - [JsonProperty(PropertyName = "properties.hourlyRecurrence")] - public HourDetailsFragment HourlyRecurrence { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hourlyRecurrence")] + public HourDetailsFragment HourlyRecurrence {get; set; } /// /// Gets or sets the time zone ID (e.g. Pacific Standard time). /// - [JsonProperty(PropertyName = "properties.timeZoneId")] - public string TimeZoneId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId {get; set; } /// /// Gets or sets notification settings. /// - [JsonProperty(PropertyName = "properties.notificationSettings")] - public NotificationSettingsFragment NotificationSettings { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettingsFragment NotificationSettings {get; set; } /// /// Gets or sets the resource ID to which the schedule belongs /// - [JsonProperty(PropertyName = "properties.targetResourceId")] - public string TargetResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceId")] + public string TargetResourceId {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleProperties.cs new file mode 100644 index 000000000000..e2eb2a1760c0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedule. + /// + public partial class ScheduleProperties + { + /// + /// Initializes a new instance of the ScheduleProperties class. + /// + public ScheduleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleProperties class. + /// + + /// The status of the schedule (i.e. Enabled, Disabled) + /// Possible values include: 'Enabled', 'Disabled' + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// + + /// If the schedule will occur only some days of the week, specify the weekly + /// recurrence. + /// + + /// If the schedule will occur once each day of the week, specify the daily + /// recurrence. + /// + + /// If the schedule will occur multiple times a day, specify the hourly + /// recurrence. + /// + + /// The time zone ID (e.g. Pacific Standard time). + /// + + /// Notification settings. + /// + + /// The creation date of the schedule. + /// + + /// The resource ID to which the schedule belongs + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ScheduleProperties(string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), NotificationSettings notificationSettings = default(NotificationSettings), System.DateTime? createdDate = default(System.DateTime?), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Status = status; + this.TaskType = taskType; + this.WeeklyRecurrence = weeklyRecurrence; + this.DailyRecurrence = dailyRecurrence; + this.HourlyRecurrence = hourlyRecurrence; + this.TimeZoneId = timeZoneId; + this.NotificationSettings = notificationSettings; + this.CreatedDate = createdDate; + this.TargetResourceId = targetResourceId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled) Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. LabVmsShutdownTask, + /// LabVmAutoStart). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "taskType")] + public string TaskType {get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, specify + /// the weekly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "weeklyRecurrence")] + public WeekDetails WeeklyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, specify + /// the daily recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dailyRecurrence")] + public DayDetails DailyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, specify the + /// hourly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hourlyRecurrence")] + public HourDetails HourlyRecurrence {get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeZoneId")] + public string TimeZoneId {get; set; } + + /// + /// Gets or sets notification settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notificationSettings")] + public NotificationSettings NotificationSettings {get; set; } + + /// + /// Gets the creation date of the schedule. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceId")] + public string TargetResourceId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SchedulePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SchedulePropertiesFragment.cs new file mode 100644 index 000000000000..3fa59447b223 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SchedulePropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedule. + /// + public partial class SchedulePropertiesFragment + { + /// + /// Initializes a new instance of the SchedulePropertiesFragment class. + /// + public SchedulePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SchedulePropertiesFragment class. + /// + + /// The status of the schedule (i.e. Enabled, Disabled) + /// Possible values include: 'Enabled', 'Disabled' + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// + + /// If the schedule will occur only some days of the week, specify the weekly + /// recurrence. + /// + + /// If the schedule will occur once each day of the week, specify the daily + /// recurrence. + /// + + /// If the schedule will occur multiple times a day, specify the hourly + /// recurrence. + /// + + /// The time zone ID (e.g. Pacific Standard time). + /// + + /// Notification settings. + /// + + /// The resource ID to which the schedule belongs + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public SchedulePropertiesFragment(string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Status = status; + this.TaskType = taskType; + this.WeeklyRecurrence = weeklyRecurrence; + this.DailyRecurrence = dailyRecurrence; + this.HourlyRecurrence = hourlyRecurrence; + this.TimeZoneId = timeZoneId; + this.NotificationSettings = notificationSettings; + this.TargetResourceId = targetResourceId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled) Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. LabVmsShutdownTask, + /// LabVmAutoStart). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "taskType")] + public string TaskType {get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, specify + /// the weekly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "weeklyRecurrence")] + public WeekDetailsFragment WeeklyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, specify + /// the daily recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dailyRecurrence")] + public DayDetailsFragment DailyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, specify the + /// hourly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hourlyRecurrence")] + public HourDetailsFragment HourlyRecurrence {get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeZoneId")] + public string TimeZoneId {get; set; } + + /// + /// Gets or sets notification settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notificationSettings")] + public NotificationSettingsFragment NotificationSettings {get; set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceId")] + public string TargetResourceId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs index 026abc4f91dd..bc6f6d6a38fa 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A secret. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Secret : Resource { /// @@ -34,23 +24,37 @@ public Secret() /// /// Initializes a new instance of the Secret class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The value of the secret for secret - /// creation. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public Secret(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string value = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The value of the secret for secret creation. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Secret(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string value = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Value = value; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.Value = value; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -59,23 +63,23 @@ public Secret() /// partial void CustomInit(); + /// /// Gets or sets the value of the secret for secret creation. /// - [JsonProperty(PropertyName = "properties.value")] - public string Value { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.value")] + public string Value {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretProperties.cs new file mode 100644 index 000000000000..426c3e8cd196 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a secret. + /// + public partial class SecretProperties + { + /// + /// Initializes a new instance of the SecretProperties class. + /// + public SecretProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretProperties class. + /// + + /// The value of the secret for secret creation. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public SecretProperties(string value = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Value = value; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the value of the secret for secret creation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs index b6bec3e30b71..087fbdb8338c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,16 +23,29 @@ public ServiceRunner() /// /// Initializes a new instance of the ServiceRunner class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The identity of the resource. - public ServiceRunner(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IdentityProperties identity = default(IdentityProperties)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The identity of the resource. + /// + public ServiceRunner(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), IdentityProperties identity = default(IdentityProperties)) + + : base(id, name, type, location, tags) { - Identity = identity; + this.Identity = identity; CustomInit(); } @@ -49,11 +54,11 @@ public ServiceRunner() /// partial void CustomInit(); + /// /// Gets or sets the identity of the resource. /// - [JsonProperty(PropertyName = "identity")] - public IdentityProperties Identity { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs index 710a96cbe20a..faf28f9e33c7 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -22,8 +14,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class SharedPublicIpAddressConfiguration { /// - /// Initializes a new instance of the - /// SharedPublicIpAddressConfiguration class. + /// Initializes a new instance of the SharedPublicIpAddressConfiguration class. /// public SharedPublicIpAddressConfiguration() { @@ -31,13 +22,15 @@ public SharedPublicIpAddressConfiguration() } /// - /// Initializes a new instance of the - /// SharedPublicIpAddressConfiguration class. + /// Initializes a new instance of the SharedPublicIpAddressConfiguration class. /// - /// The incoming NAT rules - public SharedPublicIpAddressConfiguration(IList inboundNatRules = default(IList)) + + /// The incoming NAT rules + /// + public SharedPublicIpAddressConfiguration(System.Collections.Generic.IList inboundNatRules = default(System.Collections.Generic.IList)) + { - InboundNatRules = inboundNatRules; + this.InboundNatRules = inboundNatRules; CustomInit(); } @@ -46,11 +39,11 @@ public SharedPublicIpAddressConfiguration() /// partial void CustomInit(); + /// /// Gets or sets the incoming NAT rules /// - [JsonProperty(PropertyName = "inboundNatRules")] - public IList InboundNatRules { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "inboundNatRules")] + public System.Collections.Generic.IList InboundNatRules {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs index 336c77faa8cd..d3291b2e23a2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -22,8 +14,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class SharedPublicIpAddressConfigurationFragment { /// - /// Initializes a new instance of the - /// SharedPublicIpAddressConfigurationFragment class. + /// Initializes a new instance of the SharedPublicIpAddressConfigurationFragment class. /// public SharedPublicIpAddressConfigurationFragment() { @@ -31,13 +22,15 @@ public SharedPublicIpAddressConfigurationFragment() } /// - /// Initializes a new instance of the - /// SharedPublicIpAddressConfigurationFragment class. + /// Initializes a new instance of the SharedPublicIpAddressConfigurationFragment class. /// - /// The incoming NAT rules - public SharedPublicIpAddressConfigurationFragment(IList inboundNatRules = default(IList)) + + /// The incoming NAT rules + /// + public SharedPublicIpAddressConfigurationFragment(System.Collections.Generic.IList inboundNatRules = default(System.Collections.Generic.IList)) + { - InboundNatRules = inboundNatRules; + this.InboundNatRules = inboundNatRules; CustomInit(); } @@ -46,11 +39,11 @@ public SharedPublicIpAddressConfigurationFragment() /// partial void CustomInit(); + /// /// Gets or sets the incoming NAT rules /// - [JsonProperty(PropertyName = "inboundNatRules")] - public IList InboundNatRules { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "inboundNatRules")] + public System.Collections.Generic.IList InboundNatRules {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs index 7821c7413bc5..2a84f6ecffa6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -21,8 +15,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class ShutdownNotificationContent { /// - /// Initializes a new instance of the ShutdownNotificationContent - /// class. + /// Initializes a new instance of the ShutdownNotificationContent class. /// public ShutdownNotificationContent() { @@ -30,39 +23,55 @@ public ShutdownNotificationContent() } /// - /// Initializes a new instance of the ShutdownNotificationContent - /// class. + /// Initializes a new instance of the ShutdownNotificationContent class. /// - /// The URL to skip auto-shutdown. - /// The URL to delay shutdown by 60 - /// minutes. - /// The URL to delay shutdown by 2 - /// hours. - /// The virtual machine to be shut down. - /// The GUID for the virtual machine to be shut - /// down. - /// The owner of the virtual machine. - /// The event for which a notification will be - /// sent. - /// The text for the notification. - /// The subscription ID for the - /// schedule. - /// The resource group name for the - /// schedule. - /// The lab for the schedule. + + /// The URL to skip auto-shutdown. + /// + + /// The URL to delay shutdown by 60 minutes. + /// + + /// The URL to delay shutdown by 2 hours. + /// + + /// The virtual machine to be shut down. + /// + + /// The GUID for the virtual machine to be shut down. + /// + + /// The owner of the virtual machine. + /// + + /// The event for which a notification will be sent. + /// + + /// The text for the notification. + /// + + /// The subscription ID for the schedule. + /// + + /// The resource group name for the schedule. + /// + + /// The lab for the schedule. + /// public ShutdownNotificationContent(string skipUrl = default(string), string delayUrl60 = default(string), string delayUrl120 = default(string), string vmName = default(string), string guid = default(string), string owner = default(string), string eventType = default(string), string text = default(string), string subscriptionId = default(string), string resourceGroupName = default(string), string labName = default(string)) + { - SkipUrl = skipUrl; - DelayUrl60 = delayUrl60; - DelayUrl120 = delayUrl120; - VmName = vmName; - Guid = guid; - Owner = owner; - EventType = eventType; - Text = text; - SubscriptionId = subscriptionId; - ResourceGroupName = resourceGroupName; - LabName = labName; + this.SkipUrl = skipUrl; + this.DelayUrl60 = delayUrl60; + this.DelayUrl120 = delayUrl120; + this.VMName = vmName; + this.Guid = guid; + this.Owner = owner; + this.EventType = eventType; + this.Text = text; + this.SubscriptionId = subscriptionId; + this.ResourceGroupName = resourceGroupName; + this.LabName = labName; CustomInit(); } @@ -71,71 +80,71 @@ public ShutdownNotificationContent() /// partial void CustomInit(); + /// /// Gets or sets the URL to skip auto-shutdown. /// - [JsonProperty(PropertyName = "skipUrl")] - public string SkipUrl { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "skipUrl")] + public string SkipUrl {get; set; } /// /// Gets or sets the URL to delay shutdown by 60 minutes. /// - [JsonProperty(PropertyName = "delayUrl60")] - public string DelayUrl60 { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "delayUrl60")] + public string DelayUrl60 {get; set; } /// /// Gets or sets the URL to delay shutdown by 2 hours. /// - [JsonProperty(PropertyName = "delayUrl120")] - public string DelayUrl120 { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "delayUrl120")] + public string DelayUrl120 {get; set; } /// /// Gets or sets the virtual machine to be shut down. /// - [JsonProperty(PropertyName = "vmName")] - public string VmName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "vmName")] + public string VMName {get; set; } /// /// Gets or sets the GUID for the virtual machine to be shut down. /// - [JsonProperty(PropertyName = "guid")] - public string Guid { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "guid")] + public string Guid {get; set; } /// /// Gets or sets the owner of the virtual machine. /// - [JsonProperty(PropertyName = "owner")] - public string Owner { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "owner")] + public string Owner {get; set; } /// /// Gets or sets the event for which a notification will be sent. /// - [JsonProperty(PropertyName = "eventType")] - public string EventType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "eventType")] + public string EventType {get; set; } /// /// Gets or sets the text for the notification. /// - [JsonProperty(PropertyName = "text")] - public string Text { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "text")] + public string Text {get; set; } /// /// Gets or sets the subscription ID for the schedule. /// - [JsonProperty(PropertyName = "subscriptionId")] - public string SubscriptionId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId {get; set; } /// /// Gets or sets the resource group name for the schedule. /// - [JsonProperty(PropertyName = "resourceGroupName")] - public string ResourceGroupName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName {get; set; } /// /// Gets or sets the lab for the schedule. /// - [JsonProperty(PropertyName = "labName")] - public string LabName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "labName")] + public string LabName {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs index 971c18e93a54..6326b6a79b1d 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for SourceControlType. /// + + public static class SourceControlType { public const string VsoGit = "VsoGit"; public const string GitHub = "GitHub"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs index 54e99c938c3e..52852464f326 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for StorageType. /// + + public static class StorageType { public const string Standard = "Standard"; public const string Premium = "Premium"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs index ff6eae4914cd..b8a453af0da5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,17 +23,22 @@ public Subnet() /// /// Initializes a new instance of the Subnet class. /// - /// The resource ID of the subnet. - /// The name of the subnet as seen in the - /// lab. - /// The permission policy of the subnet for - /// allowing public IP addresses (i.e. Allow, Deny)). Possible values - /// include: 'Default', 'Deny', 'Allow' - public Subnet(string resourceId = default(string), string labSubnetName = default(string), string allowPublicIp = default(string)) + + /// The resource ID of the subnet. + /// + + /// The name of the subnet as seen in the lab. + /// + + /// The permission policy of the subnet for allowing public IP addresses (i.e. + /// Allow, Deny)). + /// Possible values include: 'Default', 'Deny', 'Allow' + public Subnet(string resourceId = default(string), string labSubnetName = default(string), string allowPublicIP = default(string)) + { - ResourceId = resourceId; - LabSubnetName = labSubnetName; - AllowPublicIp = allowPublicIp; + this.ResourceId = resourceId; + this.LabSubnetName = labSubnetName; + this.AllowPublicIP = allowPublicIP; CustomInit(); } @@ -48,25 +47,24 @@ public Subnet() /// partial void CustomInit(); + /// /// Gets or sets the resource ID of the subnet. /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } /// /// Gets or sets the name of the subnet as seen in the lab. /// - [JsonProperty(PropertyName = "labSubnetName")] - public string LabSubnetName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } /// - /// Gets or sets the permission policy of the subnet for allowing - /// public IP addresses (i.e. Allow, Deny)). Possible values include: - /// 'Default', 'Deny', 'Allow' + /// Gets or sets the permission policy of the subnet for allowing public IP + /// addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow' /// - [JsonProperty(PropertyName = "allowPublicIp")] - public string AllowPublicIp { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "allowPublicIp")] + public string AllowPublicIP {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs index 4d98ebc44731..3016eccf28c6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,17 +23,22 @@ public SubnetFragment() /// /// Initializes a new instance of the SubnetFragment class. /// - /// The resource ID of the subnet. - /// The name of the subnet as seen in the - /// lab. - /// The permission policy of the subnet for - /// allowing public IP addresses (i.e. Allow, Deny)). Possible values - /// include: 'Default', 'Deny', 'Allow' - public SubnetFragment(string resourceId = default(string), string labSubnetName = default(string), string allowPublicIp = default(string)) + + /// The resource ID of the subnet. + /// + + /// The name of the subnet as seen in the lab. + /// + + /// The permission policy of the subnet for allowing public IP addresses (i.e. + /// Allow, Deny)). + /// Possible values include: 'Default', 'Deny', 'Allow' + public SubnetFragment(string resourceId = default(string), string labSubnetName = default(string), string allowPublicIP = default(string)) + { - ResourceId = resourceId; - LabSubnetName = labSubnetName; - AllowPublicIp = allowPublicIp; + this.ResourceId = resourceId; + this.LabSubnetName = labSubnetName; + this.AllowPublicIP = allowPublicIP; CustomInit(); } @@ -48,25 +47,24 @@ public SubnetFragment() /// partial void CustomInit(); + /// /// Gets or sets the resource ID of the subnet. /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } /// /// Gets or sets the name of the subnet as seen in the lab. /// - [JsonProperty(PropertyName = "labSubnetName")] - public string LabSubnetName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } /// - /// Gets or sets the permission policy of the subnet for allowing - /// public IP addresses (i.e. Allow, Deny)). Possible values include: - /// 'Default', 'Deny', 'Allow' + /// Gets or sets the permission policy of the subnet for allowing public IP + /// addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow' /// - [JsonProperty(PropertyName = "allowPublicIp")] - public string AllowPublicIp { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "allowPublicIp")] + public string AllowPublicIP {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs index 8c3389b70183..d24869e8cfaf 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,28 +23,35 @@ public SubnetOverride() /// /// Initializes a new instance of the SubnetOverride class. /// - /// The resource ID of the subnet. - /// The name given to the subnet within the - /// lab. - /// Indicates whether this - /// subnet can be used during virtual machine creation (i.e. Allow, - /// Deny). Possible values include: 'Default', 'Deny', 'Allow' - /// Indicates whether public - /// IP addresses can be assigned to virtual machines on this subnet - /// (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', - /// 'Allow' - /// Properties that - /// virtual machines on this subnet will share. - /// The virtual network pool - /// associated with this subnet. - public SubnetOverride(string resourceId = default(string), string labSubnetName = default(string), string useInVmCreationPermission = default(string), string usePublicIpAddressPermission = default(string), SubnetSharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration = default(SubnetSharedPublicIpAddressConfiguration), string virtualNetworkPoolName = default(string)) + + /// The resource ID of the subnet. + /// + + /// The name given to the subnet within the lab. + /// + + /// Indicates whether this subnet can be used during virtual machine creation + /// (i.e. Allow, Deny). + /// Possible values include: 'Default', 'Deny', 'Allow' + + /// Indicates whether public IP addresses can be assigned to virtual machines + /// on this subnet (i.e. Allow, Deny). + /// Possible values include: 'Default', 'Deny', 'Allow' + + /// Properties that virtual machines on this subnet will share. + /// + + /// The virtual network pool associated with this subnet. + /// + public SubnetOverride(string resourceId = default(string), string labSubnetName = default(string), string useInVMCreationPermission = default(string), string usePublicIPAddressPermission = default(string), SubnetSharedPublicIpAddressConfiguration sharedPublicIPAddressConfiguration = default(SubnetSharedPublicIpAddressConfiguration), string virtualNetworkPoolName = default(string)) + { - ResourceId = resourceId; - LabSubnetName = labSubnetName; - UseInVmCreationPermission = useInVmCreationPermission; - UsePublicIpAddressPermission = usePublicIpAddressPermission; - SharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; - VirtualNetworkPoolName = virtualNetworkPoolName; + this.ResourceId = resourceId; + this.LabSubnetName = labSubnetName; + this.UseInVMCreationPermission = useInVMCreationPermission; + this.UsePublicIPAddressPermission = usePublicIPAddressPermission; + this.SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; + this.VirtualNetworkPoolName = virtualNetworkPoolName; CustomInit(); } @@ -59,46 +60,43 @@ public SubnetOverride() /// partial void CustomInit(); + /// /// Gets or sets the resource ID of the subnet. /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } /// /// Gets or sets the name given to the subnet within the lab. /// - [JsonProperty(PropertyName = "labSubnetName")] - public string LabSubnetName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } /// - /// Gets or sets indicates whether this subnet can be used during - /// virtual machine creation (i.e. Allow, Deny). Possible values - /// include: 'Default', 'Deny', 'Allow' + /// Gets or sets indicates whether this subnet can be used during virtual + /// machine creation (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' /// - [JsonProperty(PropertyName = "useInVmCreationPermission")] - public string UseInVmCreationPermission { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "useInVmCreationPermission")] + public string UseInVMCreationPermission {get; set; } /// - /// Gets or sets indicates whether public IP addresses can be assigned - /// to virtual machines on this subnet (i.e. Allow, Deny). Possible - /// values include: 'Default', 'Deny', 'Allow' + /// Gets or sets indicates whether public IP addresses can be assigned to + /// virtual machines on this subnet (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' /// - [JsonProperty(PropertyName = "usePublicIpAddressPermission")] - public string UsePublicIpAddressPermission { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "usePublicIpAddressPermission")] + public string UsePublicIPAddressPermission {get; set; } /// - /// Gets or sets properties that virtual machines on this subnet will - /// share. + /// Gets or sets properties that virtual machines on this subnet will share. /// - [JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] - public SubnetSharedPublicIpAddressConfiguration SharedPublicIpAddressConfiguration { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SubnetSharedPublicIpAddressConfiguration SharedPublicIPAddressConfiguration {get; set; } /// /// Gets or sets the virtual network pool associated with this subnet. /// - [JsonProperty(PropertyName = "virtualNetworkPoolName")] - public string VirtualNetworkPoolName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkPoolName")] + public string VirtualNetworkPoolName {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs index 4aa35009a12b..1799f9ddd1ba 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,28 +23,35 @@ public SubnetOverrideFragment() /// /// Initializes a new instance of the SubnetOverrideFragment class. /// - /// The resource ID of the subnet. - /// The name given to the subnet within the - /// lab. - /// Indicates whether this - /// subnet can be used during virtual machine creation (i.e. Allow, - /// Deny). Possible values include: 'Default', 'Deny', 'Allow' - /// Indicates whether public - /// IP addresses can be assigned to virtual machines on this subnet - /// (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', - /// 'Allow' - /// Properties that - /// virtual machines on this subnet will share. - /// The virtual network pool - /// associated with this subnet. - public SubnetOverrideFragment(string resourceId = default(string), string labSubnetName = default(string), string useInVmCreationPermission = default(string), string usePublicIpAddressPermission = default(string), SubnetSharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration = default(SubnetSharedPublicIpAddressConfigurationFragment), string virtualNetworkPoolName = default(string)) + + /// The resource ID of the subnet. + /// + + /// The name given to the subnet within the lab. + /// + + /// Indicates whether this subnet can be used during virtual machine creation + /// (i.e. Allow, Deny). + /// Possible values include: 'Default', 'Deny', 'Allow' + + /// Indicates whether public IP addresses can be assigned to virtual machines + /// on this subnet (i.e. Allow, Deny). + /// Possible values include: 'Default', 'Deny', 'Allow' + + /// Properties that virtual machines on this subnet will share. + /// + + /// The virtual network pool associated with this subnet. + /// + public SubnetOverrideFragment(string resourceId = default(string), string labSubnetName = default(string), string useInVMCreationPermission = default(string), string usePublicIPAddressPermission = default(string), SubnetSharedPublicIpAddressConfigurationFragment sharedPublicIPAddressConfiguration = default(SubnetSharedPublicIpAddressConfigurationFragment), string virtualNetworkPoolName = default(string)) + { - ResourceId = resourceId; - LabSubnetName = labSubnetName; - UseInVmCreationPermission = useInVmCreationPermission; - UsePublicIpAddressPermission = usePublicIpAddressPermission; - SharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; - VirtualNetworkPoolName = virtualNetworkPoolName; + this.ResourceId = resourceId; + this.LabSubnetName = labSubnetName; + this.UseInVMCreationPermission = useInVMCreationPermission; + this.UsePublicIPAddressPermission = usePublicIPAddressPermission; + this.SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; + this.VirtualNetworkPoolName = virtualNetworkPoolName; CustomInit(); } @@ -59,46 +60,43 @@ public SubnetOverrideFragment() /// partial void CustomInit(); + /// /// Gets or sets the resource ID of the subnet. /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } /// /// Gets or sets the name given to the subnet within the lab. /// - [JsonProperty(PropertyName = "labSubnetName")] - public string LabSubnetName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } /// - /// Gets or sets indicates whether this subnet can be used during - /// virtual machine creation (i.e. Allow, Deny). Possible values - /// include: 'Default', 'Deny', 'Allow' + /// Gets or sets indicates whether this subnet can be used during virtual + /// machine creation (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' /// - [JsonProperty(PropertyName = "useInVmCreationPermission")] - public string UseInVmCreationPermission { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "useInVmCreationPermission")] + public string UseInVMCreationPermission {get; set; } /// - /// Gets or sets indicates whether public IP addresses can be assigned - /// to virtual machines on this subnet (i.e. Allow, Deny). Possible - /// values include: 'Default', 'Deny', 'Allow' + /// Gets or sets indicates whether public IP addresses can be assigned to + /// virtual machines on this subnet (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' /// - [JsonProperty(PropertyName = "usePublicIpAddressPermission")] - public string UsePublicIpAddressPermission { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "usePublicIpAddressPermission")] + public string UsePublicIPAddressPermission {get; set; } /// - /// Gets or sets properties that virtual machines on this subnet will - /// share. + /// Gets or sets properties that virtual machines on this subnet will share. /// - [JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] - public SubnetSharedPublicIpAddressConfigurationFragment SharedPublicIpAddressConfiguration { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SubnetSharedPublicIpAddressConfigurationFragment SharedPublicIPAddressConfiguration {get; set; } /// /// Gets or sets the virtual network pool associated with this subnet. /// - [JsonProperty(PropertyName = "virtualNetworkPoolName")] - public string VirtualNetworkPoolName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkPoolName")] + public string VirtualNetworkPoolName {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs index 611403e7b2e5..8d697cd39740 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class SubnetSharedPublicIpAddressConfiguration { /// - /// Initializes a new instance of the - /// SubnetSharedPublicIpAddressConfiguration class. + /// Initializes a new instance of the SubnetSharedPublicIpAddressConfiguration class. /// public SubnetSharedPublicIpAddressConfiguration() { @@ -30,14 +21,15 @@ public SubnetSharedPublicIpAddressConfiguration() } /// - /// Initializes a new instance of the - /// SubnetSharedPublicIpAddressConfiguration class. + /// Initializes a new instance of the SubnetSharedPublicIpAddressConfiguration class. /// - /// Backend ports that virtual machines on - /// this subnet are allowed to expose - public SubnetSharedPublicIpAddressConfiguration(IList allowedPorts = default(IList)) + + /// Backend ports that virtual machines on this subnet are allowed to expose + /// + public SubnetSharedPublicIpAddressConfiguration(System.Collections.Generic.IList allowedPorts = default(System.Collections.Generic.IList)) + { - AllowedPorts = allowedPorts; + this.AllowedPorts = allowedPorts; CustomInit(); } @@ -46,12 +38,12 @@ public SubnetSharedPublicIpAddressConfiguration() /// partial void CustomInit(); + /// - /// Gets or sets backend ports that virtual machines on this subnet are - /// allowed to expose + /// Gets or sets backend ports that virtual machines on this subnet are allowed + /// to expose /// - [JsonProperty(PropertyName = "allowedPorts")] - public IList AllowedPorts { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedPorts")] + public System.Collections.Generic.IList AllowedPorts {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs index 561d700b10e7..58c484bc2ee3 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models public partial class SubnetSharedPublicIpAddressConfigurationFragment { /// - /// Initializes a new instance of the - /// SubnetSharedPublicIpAddressConfigurationFragment class. + /// Initializes a new instance of the SubnetSharedPublicIpAddressConfigurationFragment class. /// public SubnetSharedPublicIpAddressConfigurationFragment() { @@ -30,14 +21,15 @@ public SubnetSharedPublicIpAddressConfigurationFragment() } /// - /// Initializes a new instance of the - /// SubnetSharedPublicIpAddressConfigurationFragment class. + /// Initializes a new instance of the SubnetSharedPublicIpAddressConfigurationFragment class. /// - /// Backend ports that virtual machines on - /// this subnet are allowed to expose - public SubnetSharedPublicIpAddressConfigurationFragment(IList allowedPorts = default(IList)) + + /// Backend ports that virtual machines on this subnet are allowed to expose + /// + public SubnetSharedPublicIpAddressConfigurationFragment(System.Collections.Generic.IList allowedPorts = default(System.Collections.Generic.IList)) + { - AllowedPorts = allowedPorts; + this.AllowedPorts = allowedPorts; CustomInit(); } @@ -46,12 +38,12 @@ public SubnetSharedPublicIpAddressConfigurationFragment() /// partial void CustomInit(); + /// - /// Gets or sets backend ports that virtual machines on this subnet are - /// allowed to expose + /// Gets or sets backend ports that virtual machines on this subnet are allowed + /// to expose /// - [JsonProperty(PropertyName = "allowedPorts")] - public IList AllowedPorts { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedPorts")] + public System.Collections.Generic.IList AllowedPorts {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs index b873e4154670..8585ef488981 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,23 +23,33 @@ public TargetCostProperties() /// /// Initializes a new instance of the TargetCostProperties class. /// - /// Target cost status. Possible values include: - /// 'Enabled', 'Disabled' - /// Lab target cost - /// Cost thresholds. - /// Reporting cycle start - /// date. - /// Reporting cycle end date. - /// Reporting cycle type. Possible values - /// include: 'CalendarMonth', 'Custom' - public TargetCostProperties(string status = default(string), int? target = default(int?), IList costThresholds = default(IList), System.DateTime? cycleStartDateTime = default(System.DateTime?), System.DateTime? cycleEndDateTime = default(System.DateTime?), string cycleType = default(string)) + + /// Target cost status + /// Possible values include: 'Enabled', 'Disabled' + + /// Lab target cost + /// + + /// Cost thresholds. + /// + + /// Reporting cycle start date. + /// + + /// Reporting cycle end date. + /// + + /// Reporting cycle type. + /// Possible values include: 'CalendarMonth', 'Custom' + public TargetCostProperties(string status = default(string), int? target = default(int?), System.Collections.Generic.IList costThresholds = default(System.Collections.Generic.IList), System.DateTime? cycleStartDateTime = default(System.DateTime?), System.DateTime? cycleEndDateTime = default(System.DateTime?), string cycleType = default(string)) + { - Status = status; - Target = target; - CostThresholds = costThresholds; - CycleStartDateTime = cycleStartDateTime; - CycleEndDateTime = cycleEndDateTime; - CycleType = cycleType; + this.Status = status; + this.Target = target; + this.CostThresholds = costThresholds; + this.CycleStartDateTime = cycleStartDateTime; + this.CycleEndDateTime = cycleEndDateTime; + this.CycleType = cycleType; CustomInit(); } @@ -56,43 +58,41 @@ public TargetCostProperties() /// partial void CustomInit(); + /// - /// Gets or sets target cost status. Possible values include: - /// 'Enabled', 'Disabled' + /// Gets or sets target cost status Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// /// Gets or sets lab target cost /// - [JsonProperty(PropertyName = "target")] - public int? Target { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + public int? Target {get; set; } /// /// Gets or sets cost thresholds. /// - [JsonProperty(PropertyName = "costThresholds")] - public IList CostThresholds { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "costThresholds")] + public System.Collections.Generic.IList CostThresholds {get; set; } /// /// Gets or sets reporting cycle start date. /// - [JsonProperty(PropertyName = "cycleStartDateTime")] - public System.DateTime? CycleStartDateTime { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "cycleStartDateTime")] + public System.DateTime? CycleStartDateTime {get; set; } /// /// Gets or sets reporting cycle end date. /// - [JsonProperty(PropertyName = "cycleEndDateTime")] - public System.DateTime? CycleEndDateTime { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "cycleEndDateTime")] + public System.DateTime? CycleEndDateTime {get; set; } /// - /// Gets or sets reporting cycle type. Possible values include: - /// 'CalendarMonth', 'Custom' + /// Gets or sets reporting cycle type. Possible values include: 'CalendarMonth', 'Custom' /// - [JsonProperty(PropertyName = "cycleType")] - public string CycleType { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "cycleType")] + public string CycleType {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs index 09e9960f369b..922c1481e423 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for TargetCostStatus. /// + + public static class TargetCostStatus { public const string Enabled = "Enabled"; public const string Disabled = "Disabled"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs index 6c16537b3406..0974b2aab3e6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for TransportProtocol. /// + + public static class TransportProtocol { public const string Tcp = "Tcp"; public const string Udp = "Udp"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs index d5715cf73a8c..29a2c9d2c1d2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for UsagePermissionType. /// + + public static class UsagePermissionType { public const string Default = "Default"; public const string Deny = "Deny"; public const string Allow = "Allow"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs index 7cd5069725ea..bd36e740e425 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// Profile of a lab user. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class User : Resource { /// @@ -34,27 +24,45 @@ public User() /// /// Initializes a new instance of the User class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The identity of the user. - /// The secret store of the user. - /// The creation date of the user - /// profile. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public User(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), UserIdentity identity = default(UserIdentity), UserSecretStore secretStore = default(UserSecretStore), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The identity of the user. + /// + + /// The secret store of the user. + /// + + /// The creation date of the user profile. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public User(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), UserIdentity identity = default(UserIdentity), UserSecretStore secretStore = default(UserSecretStore), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Identity = identity; - SecretStore = secretStore; - CreatedDate = createdDate; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.Identity = identity; + this.SecretStore = secretStore; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -63,35 +71,35 @@ public User() /// partial void CustomInit(); + /// /// Gets or sets the identity of the user. /// - [JsonProperty(PropertyName = "properties.identity")] - public UserIdentity Identity { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.identity")] + public UserIdentity Identity {get; set; } /// /// Gets or sets the secret store of the user. /// - [JsonProperty(PropertyName = "properties.secretStore")] - public UserSecretStore SecretStore { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.secretStore")] + public UserSecretStore SecretStore {get; set; } /// /// Gets the creation date of the user profile. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs index a761054ed318..c3d7c2702de7 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// Profile of a lab user. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class UserFragment : Resource { /// @@ -34,24 +24,41 @@ public UserFragment() /// /// Initializes a new instance of the UserFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The identity of the user. - /// The secret store of the user. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public UserFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), UserIdentityFragment identity = default(UserIdentityFragment), UserSecretStoreFragment secretStore = default(UserSecretStoreFragment), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The identity of the user. + /// + + /// The secret store of the user. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public UserFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), UserIdentityFragment identity = default(UserIdentityFragment), UserSecretStoreFragment secretStore = default(UserSecretStoreFragment), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - Identity = identity; - SecretStore = secretStore; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.Identity = identity; + this.SecretStore = secretStore; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -60,29 +67,29 @@ public UserFragment() /// partial void CustomInit(); + /// /// Gets or sets the identity of the user. /// - [JsonProperty(PropertyName = "properties.identity")] - public UserIdentityFragment Identity { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.identity")] + public UserIdentityFragment Identity {get; set; } /// /// Gets or sets the secret store of the user. /// - [JsonProperty(PropertyName = "properties.secretStore")] - public UserSecretStoreFragment SecretStore { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.secretStore")] + public UserSecretStoreFragment SecretStore {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs index 4300315e3bd8..a7515273362f 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,26 +23,32 @@ public UserIdentity() /// /// Initializes a new instance of the UserIdentity class. /// - /// Set to the principal name / UPN of the - /// client JWT making the request. - /// Set to the principal Id of the client JWT - /// making the request. Service principal will not have the principal - /// Id. - /// Set to the tenant ID of the client JWT - /// making the request. - /// Set to the object Id of the client JWT - /// making the request. Not all users have object Id. For CSP - /// (reseller) scenarios for example, object Id is not - /// available. - /// Set to the app Id of the client JWT making the - /// request. + + /// Set to the principal name / UPN of the client JWT making the request. + /// + + /// Set to the principal Id of the client JWT making the request. Service + /// principal will not have the principal Id. + /// + + /// Set to the tenant ID of the client JWT making the request. + /// + + /// Set to the object Id of the client JWT making the request. Not all users + /// have object Id. For CSP (reseller) scenarios for example, object Id is not + /// available. + /// + + /// Set to the app Id of the client JWT making the request. + /// public UserIdentity(string principalName = default(string), string principalId = default(string), string tenantId = default(string), string objectId = default(string), string appId = default(string)) + { - PrincipalName = principalName; - PrincipalId = principalId; - TenantId = tenantId; - ObjectId = objectId; - AppId = appId; + this.PrincipalName = principalName; + this.PrincipalId = principalId; + this.TenantId = tenantId; + this.ObjectId = objectId; + this.AppId = appId; CustomInit(); } @@ -57,41 +57,39 @@ public UserIdentity() /// partial void CustomInit(); + /// - /// Gets or sets set to the principal name / UPN of the client JWT - /// making the request. + /// Gets or sets set to the principal name / UPN of the client JWT making the + /// request. /// - [JsonProperty(PropertyName = "principalName")] - public string PrincipalName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "principalName")] + public string PrincipalName {get; set; } /// - /// Gets or sets set to the principal Id of the client JWT making the - /// request. Service principal will not have the principal Id. + /// Gets or sets set to the principal Id of the client JWT making the request. + /// Service principal will not have the principal Id. /// - [JsonProperty(PropertyName = "principalId")] - public string PrincipalId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } /// - /// Gets or sets set to the tenant ID of the client JWT making the - /// request. + /// Gets or sets set to the tenant ID of the client JWT making the request. /// - [JsonProperty(PropertyName = "tenantId")] - public string TenantId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; set; } /// - /// Gets or sets set to the object Id of the client JWT making the - /// request. Not all users have object Id. For CSP (reseller) scenarios - /// for example, object Id is not available. + /// Gets or sets set to the object Id of the client JWT making the request. Not + /// all users have object Id. For CSP (reseller) scenarios for example, object + /// Id is not available. /// - [JsonProperty(PropertyName = "objectId")] - public string ObjectId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "objectId")] + public string ObjectId {get; set; } /// - /// Gets or sets set to the app Id of the client JWT making the - /// request. + /// Gets or sets set to the app Id of the client JWT making the request. /// - [JsonProperty(PropertyName = "appId")] - public string AppId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "appId")] + public string AppId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs index da124b736c0c..360e39177e8c 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,26 +23,32 @@ public UserIdentityFragment() /// /// Initializes a new instance of the UserIdentityFragment class. /// - /// Set to the principal name / UPN of the - /// client JWT making the request. - /// Set to the principal Id of the client JWT - /// making the request. Service principal will not have the principal - /// Id. - /// Set to the tenant ID of the client JWT - /// making the request. - /// Set to the object Id of the client JWT - /// making the request. Not all users have object Id. For CSP - /// (reseller) scenarios for example, object Id is not - /// available. - /// Set to the app Id of the client JWT making the - /// request. + + /// Set to the principal name / UPN of the client JWT making the request. + /// + + /// Set to the principal Id of the client JWT making the request. Service + /// principal will not have the principal Id. + /// + + /// Set to the tenant ID of the client JWT making the request. + /// + + /// Set to the object Id of the client JWT making the request. Not all users + /// have object Id. For CSP (reseller) scenarios for example, object Id is not + /// available. + /// + + /// Set to the app Id of the client JWT making the request. + /// public UserIdentityFragment(string principalName = default(string), string principalId = default(string), string tenantId = default(string), string objectId = default(string), string appId = default(string)) + { - PrincipalName = principalName; - PrincipalId = principalId; - TenantId = tenantId; - ObjectId = objectId; - AppId = appId; + this.PrincipalName = principalName; + this.PrincipalId = principalId; + this.TenantId = tenantId; + this.ObjectId = objectId; + this.AppId = appId; CustomInit(); } @@ -57,41 +57,39 @@ public UserIdentityFragment() /// partial void CustomInit(); + /// - /// Gets or sets set to the principal name / UPN of the client JWT - /// making the request. + /// Gets or sets set to the principal name / UPN of the client JWT making the + /// request. /// - [JsonProperty(PropertyName = "principalName")] - public string PrincipalName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "principalName")] + public string PrincipalName {get; set; } /// - /// Gets or sets set to the principal Id of the client JWT making the - /// request. Service principal will not have the principal Id. + /// Gets or sets set to the principal Id of the client JWT making the request. + /// Service principal will not have the principal Id. /// - [JsonProperty(PropertyName = "principalId")] - public string PrincipalId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } /// - /// Gets or sets set to the tenant ID of the client JWT making the - /// request. + /// Gets or sets set to the tenant ID of the client JWT making the request. /// - [JsonProperty(PropertyName = "tenantId")] - public string TenantId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; set; } /// - /// Gets or sets set to the object Id of the client JWT making the - /// request. Not all users have object Id. For CSP (reseller) scenarios - /// for example, object Id is not available. + /// Gets or sets set to the object Id of the client JWT making the request. Not + /// all users have object Id. For CSP (reseller) scenarios for example, object + /// Id is not available. /// - [JsonProperty(PropertyName = "objectId")] - public string ObjectId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "objectId")] + public string ObjectId {get; set; } /// - /// Gets or sets set to the app Id of the client JWT making the - /// request. + /// Gets or sets set to the app Id of the client JWT making the request. /// - [JsonProperty(PropertyName = "appId")] - public string AppId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "appId")] + public string AppId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserProperties.cs new file mode 100644 index 000000000000..cd593f581cf0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a lab user profile. + /// + public partial class UserProperties + { + /// + /// Initializes a new instance of the UserProperties class. + /// + public UserProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserProperties class. + /// + + /// The identity of the user. + /// + + /// The secret store of the user. + /// + + /// The creation date of the user profile. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public UserProperties(UserIdentity identity = default(UserIdentity), UserSecretStore secretStore = default(UserSecretStore), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Identity = identity; + this.SecretStore = secretStore; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identity of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public UserIdentity Identity {get; set; } + + /// + /// Gets or sets the secret store of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "secretStore")] + public UserSecretStore SecretStore {get; set; } + + /// + /// Gets the creation date of the user profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserPropertiesFragment.cs new file mode 100644 index 000000000000..a3d6821a5a51 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserPropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a lab user profile. + /// + public partial class UserPropertiesFragment + { + /// + /// Initializes a new instance of the UserPropertiesFragment class. + /// + public UserPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserPropertiesFragment class. + /// + + /// The identity of the user. + /// + + /// The secret store of the user. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public UserPropertiesFragment(UserIdentityFragment identity = default(UserIdentityFragment), UserSecretStoreFragment secretStore = default(UserSecretStoreFragment), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Identity = identity; + this.SecretStore = secretStore; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identity of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public UserIdentityFragment Identity {get; set; } + + /// + /// Gets or sets the secret store of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "secretStore")] + public UserSecretStoreFragment SecretStore {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs index 009e9f5bc1c7..b8a08876232b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs @@ -1,20 +1,14 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// - /// Properties of a user's secret store. + /// Properties of a user's secret store. /// public partial class UserSecretStore { @@ -29,12 +23,17 @@ public UserSecretStore() /// /// Initializes a new instance of the UserSecretStore class. /// - /// The URI of the user's Key vault. - /// The ID of the user's Key vault. + + /// The URI of the user's Key vault. + /// + + /// The ID of the user's Key vault. + /// public UserSecretStore(string keyVaultUri = default(string), string keyVaultId = default(string)) + { - KeyVaultUri = keyVaultUri; - KeyVaultId = keyVaultId; + this.KeyVaultUri = keyVaultUri; + this.KeyVaultId = keyVaultId; CustomInit(); } @@ -43,17 +42,17 @@ public UserSecretStore() /// partial void CustomInit(); + /// - /// Gets or sets the URI of the user's Key vault. + /// Gets or sets the URI of the user's Key vault. /// - [JsonProperty(PropertyName = "keyVaultUri")] - public string KeyVaultUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri {get; set; } /// - /// Gets or sets the ID of the user's Key vault. + /// Gets or sets the ID of the user's Key vault. /// - [JsonProperty(PropertyName = "keyVaultId")] - public string KeyVaultId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultId")] + public string KeyVaultId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs index b0c2bf8da693..b47a2fe79336 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs @@ -1,20 +1,14 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// - /// Properties of a user's secret store. + /// Properties of a user's secret store. /// public partial class UserSecretStoreFragment { @@ -29,12 +23,17 @@ public UserSecretStoreFragment() /// /// Initializes a new instance of the UserSecretStoreFragment class. /// - /// The URI of the user's Key vault. - /// The ID of the user's Key vault. + + /// The URI of the user's Key vault. + /// + + /// The ID of the user's Key vault. + /// public UserSecretStoreFragment(string keyVaultUri = default(string), string keyVaultId = default(string)) + { - KeyVaultUri = keyVaultUri; - KeyVaultId = keyVaultId; + this.KeyVaultUri = keyVaultUri; + this.KeyVaultId = keyVaultId; CustomInit(); } @@ -43,17 +42,17 @@ public UserSecretStoreFragment() /// partial void CustomInit(); + /// - /// Gets or sets the URI of the user's Key vault. + /// Gets or sets the URI of the user's Key vault. /// - [JsonProperty(PropertyName = "keyVaultUri")] - public string KeyVaultUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri {get; set; } /// - /// Gets or sets the ID of the user's Key vault. + /// Gets or sets the ID of the user's Key vault. /// - [JsonProperty(PropertyName = "keyVaultId")] - public string KeyVaultId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultId")] + public string KeyVaultId {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs index 4899e4d31fb4..3af568a510c5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for VirtualMachineCreationSource. /// + + public static class VirtualMachineCreationSource { public const string FromCustomImage = "FromCustomImage"; public const string FromGalleryImage = "FromGalleryImage"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs index 3a27d184f4fc..f8dde6a443e5 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A virtual network. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class VirtualNetwork : Resource { /// @@ -34,38 +24,57 @@ public VirtualNetwork() /// /// Initializes a new instance of the VirtualNetwork class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The allowed subnets of the virtual - /// network. - /// The description of the virtual - /// network. - /// The Microsoft.Network - /// resource identifier of the virtual network. - /// The external subnet - /// properties. - /// The subnet overrides of the virtual - /// network. - /// The creation date of the virtual - /// network. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public VirtualNetwork(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList allowedSubnets = default(IList), string description = default(string), string externalProviderResourceId = default(string), IList externalSubnets = default(IList), IList subnetOverrides = default(IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The allowed subnets of the virtual network. + /// + + /// The description of the virtual network. + /// + + /// The Microsoft.Network resource identifier of the virtual network. + /// + + /// The external subnet properties. + /// + + /// The subnet overrides of the virtual network. + /// + + /// The creation date of the virtual network. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public VirtualNetwork(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList allowedSubnets = default(System.Collections.Generic.IList), string description = default(string), string externalProviderResourceId = default(string), System.Collections.Generic.IList externalSubnets = default(System.Collections.Generic.IList), System.Collections.Generic.IList subnetOverrides = default(System.Collections.Generic.IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - AllowedSubnets = allowedSubnets; - Description = description; - ExternalProviderResourceId = externalProviderResourceId; - ExternalSubnets = externalSubnets; - SubnetOverrides = subnetOverrides; - CreatedDate = createdDate; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.AllowedSubnets = allowedSubnets; + this.Description = description; + this.ExternalProviderResourceId = externalProviderResourceId; + this.ExternalSubnets = externalSubnets; + this.SubnetOverrides = subnetOverrides; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -74,54 +83,54 @@ public VirtualNetwork() /// partial void CustomInit(); + /// /// Gets or sets the allowed subnets of the virtual network. /// - [JsonProperty(PropertyName = "properties.allowedSubnets")] - public IList AllowedSubnets { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowedSubnets")] + public System.Collections.Generic.IList AllowedSubnets {get; set; } /// /// Gets or sets the description of the virtual network. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// - /// Gets or sets the Microsoft.Network resource identifier of the - /// virtual network. + /// Gets or sets the Microsoft.Network resource identifier of the virtual + /// network. /// - [JsonProperty(PropertyName = "properties.externalProviderResourceId")] - public string ExternalProviderResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalProviderResourceId")] + public string ExternalProviderResourceId {get; set; } /// /// Gets or sets the external subnet properties. /// - [JsonProperty(PropertyName = "properties.externalSubnets")] - public IList ExternalSubnets { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalSubnets")] + public System.Collections.Generic.IList ExternalSubnets {get; set; } /// /// Gets or sets the subnet overrides of the virtual network. /// - [JsonProperty(PropertyName = "properties.subnetOverrides")] - public IList SubnetOverrides { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subnetOverrides")] + public System.Collections.Generic.IList SubnetOverrides {get; set; } /// /// Gets the creation date of the virtual network. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs index 7e795d721327..ae364e9d1ba2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A virtual network. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class VirtualNetworkFragment : Resource { /// @@ -34,35 +24,53 @@ public VirtualNetworkFragment() /// /// Initializes a new instance of the VirtualNetworkFragment class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The allowed subnets of the virtual - /// network. - /// The description of the virtual - /// network. - /// The Microsoft.Network - /// resource identifier of the virtual network. - /// The external subnet - /// properties. - /// The subnet overrides of the virtual - /// network. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public VirtualNetworkFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList allowedSubnets = default(IList), string description = default(string), string externalProviderResourceId = default(string), IList externalSubnets = default(IList), IList subnetOverrides = default(IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) + + /// The identifier of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The allowed subnets of the virtual network. + /// + + /// The description of the virtual network. + /// + + /// The Microsoft.Network resource identifier of the virtual network. + /// + + /// The external subnet properties. + /// + + /// The subnet overrides of the virtual network. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public VirtualNetworkFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList allowedSubnets = default(System.Collections.Generic.IList), string description = default(string), string externalProviderResourceId = default(string), System.Collections.Generic.IList externalSubnets = default(System.Collections.Generic.IList), System.Collections.Generic.IList subnetOverrides = default(System.Collections.Generic.IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) { - AllowedSubnets = allowedSubnets; - Description = description; - ExternalProviderResourceId = externalProviderResourceId; - ExternalSubnets = externalSubnets; - SubnetOverrides = subnetOverrides; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; + this.AllowedSubnets = allowedSubnets; + this.Description = description; + this.ExternalProviderResourceId = externalProviderResourceId; + this.ExternalSubnets = externalSubnets; + this.SubnetOverrides = subnetOverrides; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; CustomInit(); } @@ -71,48 +79,48 @@ public VirtualNetworkFragment() /// partial void CustomInit(); + /// /// Gets or sets the allowed subnets of the virtual network. /// - [JsonProperty(PropertyName = "properties.allowedSubnets")] - public IList AllowedSubnets { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowedSubnets")] + public System.Collections.Generic.IList AllowedSubnets {get; set; } /// /// Gets or sets the description of the virtual network. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// - /// Gets or sets the Microsoft.Network resource identifier of the - /// virtual network. + /// Gets or sets the Microsoft.Network resource identifier of the virtual + /// network. /// - [JsonProperty(PropertyName = "properties.externalProviderResourceId")] - public string ExternalProviderResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalProviderResourceId")] + public string ExternalProviderResourceId {get; set; } /// /// Gets or sets the external subnet properties. /// - [JsonProperty(PropertyName = "properties.externalSubnets")] - public IList ExternalSubnets { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalSubnets")] + public System.Collections.Generic.IList ExternalSubnets {get; set; } /// /// Gets or sets the subnet overrides of the virtual network. /// - [JsonProperty(PropertyName = "properties.subnetOverrides")] - public IList SubnetOverrides { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subnetOverrides")] + public System.Collections.Generic.IList SubnetOverrides {get; set; } /// /// Gets or sets the provisioning status of the resource. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// /// Gets or sets the unique immutable identifier of a resource (Guid). /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkProperties.cs new file mode 100644 index 000000000000..19170159dc64 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual network. + /// + public partial class VirtualNetworkProperties + { + /// + /// Initializes a new instance of the VirtualNetworkProperties class. + /// + public VirtualNetworkProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkProperties class. + /// + + /// The allowed subnets of the virtual network. + /// + + /// The description of the virtual network. + /// + + /// The Microsoft.Network resource identifier of the virtual network. + /// + + /// The external subnet properties. + /// + + /// The subnet overrides of the virtual network. + /// + + /// The creation date of the virtual network. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public VirtualNetworkProperties(System.Collections.Generic.IList allowedSubnets = default(System.Collections.Generic.IList), string description = default(string), string externalProviderResourceId = default(string), System.Collections.Generic.IList externalSubnets = default(System.Collections.Generic.IList), System.Collections.Generic.IList subnetOverrides = default(System.Collections.Generic.IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.AllowedSubnets = allowedSubnets; + this.Description = description; + this.ExternalProviderResourceId = externalProviderResourceId; + this.ExternalSubnets = externalSubnets; + this.SubnetOverrides = subnetOverrides; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the allowed subnets of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedSubnets")] + public System.Collections.Generic.IList AllowedSubnets {get; set; } + + /// + /// Gets or sets the description of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the Microsoft.Network resource identifier of the virtual + /// network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalProviderResourceId")] + public string ExternalProviderResourceId {get; set; } + + /// + /// Gets or sets the external subnet properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalSubnets")] + public System.Collections.Generic.IList ExternalSubnets {get; set; } + + /// + /// Gets or sets the subnet overrides of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetOverrides")] + public System.Collections.Generic.IList SubnetOverrides {get; set; } + + /// + /// Gets the creation date of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkPropertiesFragment.cs new file mode 100644 index 000000000000..98a2e99a0291 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkPropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual network. + /// + public partial class VirtualNetworkPropertiesFragment + { + /// + /// Initializes a new instance of the VirtualNetworkPropertiesFragment class. + /// + public VirtualNetworkPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkPropertiesFragment class. + /// + + /// The allowed subnets of the virtual network. + /// + + /// The description of the virtual network. + /// + + /// The Microsoft.Network resource identifier of the virtual network. + /// + + /// The external subnet properties. + /// + + /// The subnet overrides of the virtual network. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public VirtualNetworkPropertiesFragment(System.Collections.Generic.IList allowedSubnets = default(System.Collections.Generic.IList), string description = default(string), string externalProviderResourceId = default(string), System.Collections.Generic.IList externalSubnets = default(System.Collections.Generic.IList), System.Collections.Generic.IList subnetOverrides = default(System.Collections.Generic.IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.AllowedSubnets = allowedSubnets; + this.Description = description; + this.ExternalProviderResourceId = externalProviderResourceId; + this.ExternalSubnets = externalSubnets; + this.SubnetOverrides = subnetOverrides; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the allowed subnets of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedSubnets")] + public System.Collections.Generic.IList AllowedSubnets {get; set; } + + /// + /// Gets or sets the description of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the Microsoft.Network resource identifier of the virtual + /// network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalProviderResourceId")] + public string ExternalProviderResourceId {get; set; } + + /// + /// Gets or sets the external subnet properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalSubnets")] + public System.Collections.Generic.IList ExternalSubnets {get; set; } + + /// + /// Gets or sets the subnet overrides of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetOverrides")] + public System.Collections.Generic.IList SubnetOverrides {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs index 528ecce78b17..3259956ca1b0 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,14 +23,18 @@ public WeekDetails() /// /// Initializes a new instance of the WeekDetails class. /// - /// The days of the week for which the schedule - /// is set (e.g. Sunday, Monday, Tuesday, etc.). - /// The time of the day the schedule will - /// occur. - public WeekDetails(IList weekdays = default(IList), string time = default(string)) + + /// The days of the week for which the schedule is set (e.g. Sunday, Monday, + /// Tuesday, etc.). + /// + + /// The time of the day the schedule will occur. + /// + public WeekDetails(System.Collections.Generic.IList weekdays = default(System.Collections.Generic.IList), string time = default(string)) + { - Weekdays = weekdays; - Time = time; + this.Weekdays = weekdays; + this.Time = time; CustomInit(); } @@ -47,18 +43,18 @@ public WeekDetails() /// partial void CustomInit(); + /// - /// Gets or sets the days of the week for which the schedule is set - /// (e.g. Sunday, Monday, Tuesday, etc.). + /// Gets or sets the days of the week for which the schedule is set (e.g. + /// Sunday, Monday, Tuesday, etc.). /// - [JsonProperty(PropertyName = "weekdays")] - public IList Weekdays { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "weekdays")] + public System.Collections.Generic.IList Weekdays {get; set; } /// /// Gets or sets the time of the day the schedule will occur. /// - [JsonProperty(PropertyName = "time")] - public string Time { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "time")] + public string Time {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs index ccc4a5195f54..ea53f93d4f0e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,14 +23,18 @@ public WeekDetailsFragment() /// /// Initializes a new instance of the WeekDetailsFragment class. /// - /// The days of the week for which the schedule - /// is set (e.g. Sunday, Monday, Tuesday, etc.). - /// The time of the day the schedule will - /// occur. - public WeekDetailsFragment(IList weekdays = default(IList), string time = default(string)) + + /// The days of the week for which the schedule is set (e.g. Sunday, Monday, + /// Tuesday, etc.). + /// + + /// The time of the day the schedule will occur. + /// + public WeekDetailsFragment(System.Collections.Generic.IList weekdays = default(System.Collections.Generic.IList), string time = default(string)) + { - Weekdays = weekdays; - Time = time; + this.Weekdays = weekdays; + this.Time = time; CustomInit(); } @@ -47,18 +43,18 @@ public WeekDetailsFragment() /// partial void CustomInit(); + /// - /// Gets or sets the days of the week for which the schedule is set - /// (e.g. Sunday, Monday, Tuesday, etc.). + /// Gets or sets the days of the week for which the schedule is set (e.g. + /// Sunday, Monday, Tuesday, etc.). /// - [JsonProperty(PropertyName = "weekdays")] - public IList Weekdays { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "weekdays")] + public System.Collections.Generic.IList Weekdays {get; set; } /// /// Gets or sets the time of the day the schedule will occur. /// - [JsonProperty(PropertyName = "time")] - public string Time { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "time")] + public string Time {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs index ecd2c48d18eb..0efc7b403976 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,13 +23,15 @@ public WindowsOsInfo() /// /// Initializes a new instance of the WindowsOsInfo class. /// - /// The state of the Windows OS (i.e. - /// NonSysprepped, SysprepRequested, SysprepApplied). Possible values - /// include: 'NonSysprepped', 'SysprepRequested', - /// 'SysprepApplied' - public WindowsOsInfo(string windowsOsState = default(string)) + + /// The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, + /// SysprepApplied). + /// Possible values include: 'NonSysprepped', 'SysprepRequested', + /// 'SysprepApplied' + public WindowsOsInfo(string windowsOSState = default(string)) + { - WindowsOsState = windowsOsState; + this.WindowsOSState = windowsOSState; CustomInit(); } @@ -44,13 +40,12 @@ public WindowsOsInfo() /// partial void CustomInit(); + /// /// Gets or sets the state of the Windows OS (i.e. NonSysprepped, - /// SysprepRequested, SysprepApplied). Possible values include: - /// 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' + /// SysprepRequested, SysprepApplied). Possible values include: 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' /// - [JsonProperty(PropertyName = "windowsOsState")] - public string WindowsOsState { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "windowsOsState")] + public string WindowsOSState {get; set; } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs index c97401fc9db1..f02e7aa9b563 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.DevTestLabs.Models /// /// Defines values for WindowsOsState. /// + + public static class WindowsOsState { public const string NonSysprepped = "NonSysprepped"; public const string SysprepRequested = "SysprepRequested"; public const string SysprepApplied = "SysprepApplied"; } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs index 1b5b7fbd7a03..2f5b8f48e0ea 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// NotificationChannelsOperations operations. /// - internal partial class NotificationChannelsOperations : IServiceOperations, INotificationChannelsOperations + internal partial class NotificationChannelsOperations : Microsoft.Rest.IServiceOperations, INotificationChannelsOperations { /// /// Initializes a new instance of the NotificationChannelsOperations class. @@ -37,13 +24,13 @@ internal partial class NotificationChannelsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal NotificationChannelsOperations(DevTestLabsClient client) + internal NotificationChannelsOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// List notificationchannels in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _notificationChannel = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_notificationChannel)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_notificationChannel); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal NotificationChannelsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get notificationchannel. /// @@ -265,7 +270,7 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// The name of the notificationChannel. /// /// - /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' /// /// /// Headers that will be added to request. @@ -273,13 +278,13 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -288,81 +293,94 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -374,55 +392,56 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -432,9 +451,10 @@ internal NotificationChannelsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -445,25 +465,29 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing notificationChannel. /// @@ -482,13 +506,13 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -497,81 +521,94 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, NotificationChannel notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, NotificationChannel notificationChannel, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (notificationChannel == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "notificationChannel"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (notificationChannel == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "notificationChannel"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("notificationChannel", notificationChannel); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -583,61 +620,62 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(notificationChannel != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(notificationChannel, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(notificationChannel, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -647,9 +685,10 @@ internal NotificationChannelsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -660,16 +699,16 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -678,25 +717,29 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete notificationchannel. /// @@ -712,10 +755,10 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -724,76 +767,88 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -805,55 +860,56 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -863,20 +919,25 @@ internal NotificationChannelsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Modify properties of notificationchannels. /// @@ -895,13 +956,13 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -910,81 +971,93 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string labName, string name, NotificationChannelFragment notificationChannel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, NotificationChannelFragment notificationChannel, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (notificationChannel == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "notificationChannel"); } - if (Client.ResourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (notificationChannel == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "notificationChannel"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("notificationChannel", notificationChannel); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -996,61 +1069,62 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(notificationChannel != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(notificationChannel, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(notificationChannel, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1060,9 +1134,10 @@ internal NotificationChannelsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1073,25 +1148,29 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Send notification to provided channel. /// @@ -1110,10 +1189,10 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1122,81 +1201,94 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task NotifyWithHttpMessagesAsync(string labName, string name, NotifyParameters notifyParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task NotifyWithHttpMessagesAsync(string labName, string name, NotifyParameters notifyParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (notifyParameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "notifyParameters"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (notifyParameters == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "notifyParameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("notifyParameters", notifyParameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Notify", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Notify", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1208,61 +1300,62 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(notifyParameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(notifyParameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(notifyParameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1272,20 +1365,25 @@ internal NotificationChannelsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List notificationchannels in a given lab. /// @@ -1298,13 +1396,13 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1313,51 +1411,54 @@ internal NotificationChannelsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1369,55 +1470,56 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1427,9 +1529,10 @@ internal NotificationChannelsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1440,24 +1543,28 @@ internal NotificationChannelsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs index a88399c64d25..7ffcc4f19268 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs @@ -1,318 +1,283 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for NotificationChannelsOperations. + /// Extension methods for NotificationChannelsOperations /// public static partial class NotificationChannelsOperationsExtensions { - /// - /// List notificationchannels in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this INotificationChannelsOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List notificationchannels in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this INotificationChannelsOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get notificationchannel. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// Specify the $expand query. Example: 'properties($select=webHookUrl)' - /// - public static NotificationChannel Get(this INotificationChannelsOperations operations, string labName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get notificationchannel. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// Specify the $expand query. Example: 'properties($select=webHookUrl)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this INotificationChannelsOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing notificationChannel. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// A notification. - /// - public static NotificationChannel CreateOrUpdate(this INotificationChannelsOperations operations, string labName, string name, NotificationChannel notificationChannel) - { - return operations.CreateOrUpdateAsync(labName, name, notificationChannel).GetAwaiter().GetResult(); - } + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this INotificationChannelsOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((INotificationChannelsOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing notificationChannel. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// A notification. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this INotificationChannelsOperations operations, string labName, string name, NotificationChannel notificationChannel, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this INotificationChannelsOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + public static NotificationChannel Get(this INotificationChannelsOperations operations, string labName, string name, string expand = default(string)) + { + return ((INotificationChannelsOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Delete notificationchannel. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - public static void Delete(this INotificationChannelsOperations operations, string labName, string name) + /// + /// Get notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this INotificationChannelsOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static NotificationChannel CreateOrUpdate(this INotificationChannelsOperations operations, string labName, string name, NotificationChannel notificationChannel) + { + return ((INotificationChannelsOperations)operations).CreateOrUpdateAsync(labName, name, notificationChannel).GetAwaiter().GetResult(); + } - /// - /// Delete notificationchannel. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this INotificationChannelsOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this INotificationChannelsOperations operations, string labName, string name, NotificationChannel notificationChannel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Delete notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static void Delete(this INotificationChannelsOperations operations, string labName, string name) + { + ((INotificationChannelsOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Modify properties of notificationchannels. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// A notification. - /// - public static NotificationChannel Update(this INotificationChannelsOperations operations, string labName, string name, NotificationChannelFragment notificationChannel) - { - return operations.UpdateAsync(labName, name, notificationChannel).GetAwaiter().GetResult(); - } + /// + /// Delete notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this INotificationChannelsOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of notificationchannels. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static NotificationChannel Update(this INotificationChannelsOperations operations, string labName, string name, NotificationChannelFragment notificationChannel) + { + return ((INotificationChannelsOperations)operations).UpdateAsync(labName, name, notificationChannel).GetAwaiter().GetResult(); + } - /// - /// Modify properties of notificationchannels. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// A notification. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this INotificationChannelsOperations operations, string labName, string name, NotificationChannelFragment notificationChannel, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Modify properties of notificationchannels. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this INotificationChannelsOperations operations, string labName, string name, NotificationChannelFragment notificationChannel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Send notification to provided channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static void Notify(this INotificationChannelsOperations operations, string labName, string name, NotifyParameters notifyParameters) + { + ((INotificationChannelsOperations)operations).NotifyAsync(labName, name, notifyParameters).GetAwaiter().GetResult(); + } - /// - /// Send notification to provided channel. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// Properties for generating a Notification. - /// - public static void Notify(this INotificationChannelsOperations operations, string labName, string name, NotifyParameters notifyParameters) - { - operations.NotifyAsync(labName, name, notifyParameters).GetAwaiter().GetResult(); - } + /// + /// Send notification to provided channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task NotifyAsync(this INotificationChannelsOperations operations, string labName, string name, NotifyParameters notifyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.NotifyWithHttpMessagesAsync(labName, name, notifyParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this INotificationChannelsOperations operations, string nextPageLink) + { + return ((INotificationChannelsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Send notification to provided channel. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the notificationChannel. - /// - /// - /// Properties for generating a Notification. - /// - /// - /// The cancellation token. - /// - public static async Task NotifyAsync(this INotificationChannelsOperations operations, string labName, string name, NotifyParameters notifyParameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this INotificationChannelsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - (await operations.NotifyWithHttpMessagesAsync(labName, name, notifyParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// List notificationchannels in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this INotificationChannelsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List notificationchannels in a given lab. - /// - /// - /// 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 INotificationChannelsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs index 3b0bae030203..482d5a329730 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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 + internal partial class Operations : Microsoft.Rest.IServiceOperations, IOperations { /// /// Initializes a new instance of the Operations class. @@ -36,13 +24,13 @@ internal partial class Operations : IServiceOperations, IOper /// /// Thrown when a required parameter is null /// - internal Operations(DevTestLabsClient client) + internal Operations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -65,13 +53,13 @@ internal Operations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -80,71 +68,82 @@ internal Operations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string locationName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string locationName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (locationName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "locationName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("locationName", locationName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -156,55 +155,56 @@ internal Operations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -214,9 +214,10 @@ internal Operations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -227,24 +228,28 @@ internal Operations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs index 31bbdc304eb2..241e7290f43b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs @@ -1,65 +1,55 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for Operations. + /// Extension methods for Operations /// public static partial class OperationsExtensions { - /// - /// Get operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the location. - /// - /// - /// The name of the operation. - /// - public static OperationResult Get(this IOperations operations, string locationName, string name) - { - return operations.GetAsync(locationName, name).GetAwaiter().GetResult(); - } + /// + /// Get operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The name of the operation. + /// + public static OperationResult Get(this IOperations operations, string locationName, string name) + { + return ((IOperations)operations).GetAsync(locationName, name).GetAwaiter().GetResult(); + } - /// - /// Get operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the location. - /// - /// - /// The name of the operation. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IOperations operations, string locationName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The name of the operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IOperations operations, string locationName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, name, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(locationName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs index 60a05ffeb240..1f4c44da5521 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// PoliciesOperations operations. /// - internal partial class PoliciesOperations : IServiceOperations, IPoliciesOperations + internal partial class PoliciesOperations : Microsoft.Rest.IServiceOperations, IPoliciesOperations { /// /// Initializes a new instance of the PoliciesOperations class. @@ -37,13 +24,13 @@ internal partial class PoliciesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal PoliciesOperations(DevTestLabsClient client) + internal PoliciesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,28 +41,28 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// List policies in a given policy set. /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the policy set. /// - /// - /// 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 /// /// @@ -84,85 +71,98 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string policySetName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (policySetName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _policy = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_policy)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_policy); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -174,55 +174,56 @@ internal PoliciesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -232,9 +233,10 @@ internal PoliciesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -245,25 +247,29 @@ internal PoliciesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get policy. /// @@ -277,7 +283,7 @@ internal PoliciesOperations(DevTestLabsClient client) /// The name of the policy. /// /// - /// Specify the $expand query. Example: 'properties($select=description)' + /// Specify the $expand query. Example: 'properties($select=description)' /// /// /// Headers that will be added to request. @@ -285,13 +291,13 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -300,87 +306,101 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string policySetName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string policySetName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (policySetName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -392,55 +412,56 @@ internal PoliciesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -450,9 +471,10 @@ internal PoliciesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -463,25 +485,29 @@ internal PoliciesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing policy. /// @@ -503,13 +529,13 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -518,87 +544,101 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string policySetName, string name, Policy policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string policySetName, string name, Policy policy, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (policy == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policy"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (policySetName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (policy == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "policy"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("name", name); + tracingParameters.Add("policy", policy); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -610,61 +650,62 @@ internal PoliciesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(policy != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(policy, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(policy, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -674,9 +715,10 @@ internal PoliciesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -687,16 +729,16 @@ internal PoliciesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -705,25 +747,29 @@ internal PoliciesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete policy. /// @@ -742,10 +788,10 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -754,82 +800,95 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string policySetName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string policySetName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (policySetName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -841,55 +900,56 @@ internal PoliciesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -899,20 +959,25 @@ internal PoliciesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Modify properties of policies. /// @@ -934,13 +999,13 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -949,87 +1014,100 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string labName, string policySetName, string name, PolicyFragment policy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string policySetName, string name, PolicyFragment policy, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (policy == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policy"); + } + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (policySetName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "policySetName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (policy == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "policy"); - } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("policySetName", policySetName); tracingParameters.Add("name", name); + tracingParameters.Add("policy", policy); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1041,61 +1119,62 @@ internal PoliciesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(policy != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(policy, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(policy, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1105,9 +1184,10 @@ internal PoliciesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1118,25 +1198,29 @@ internal PoliciesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List policies in a given policy set. /// @@ -1149,13 +1233,13 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1164,51 +1248,54 @@ internal PoliciesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1220,55 +1307,56 @@ internal PoliciesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1278,9 +1366,10 @@ internal PoliciesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1291,24 +1380,28 @@ internal PoliciesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs index 63c1bde0da21..aecc58316be9 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs @@ -1,305 +1,277 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for PoliciesOperations. + /// Extension methods for PoliciesOperations /// public static partial class PoliciesOperationsExtensions { - /// - /// List policies in a given policy set. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IPoliciesOperations operations, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, policySetName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List policies in a given policy set. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IPoliciesOperations operations, string labName, string policySetName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, policySetName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + public static Microsoft.Rest.Azure.IPage List(this IPoliciesOperations operations, string labName, string policySetName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IPoliciesOperations)operations).ListAsync(labName, policySetName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// The name of the policy. - /// - /// - /// Specify the $expand query. Example: 'properties($select=description)' - /// - public static Policy Get(this IPoliciesOperations operations, string labName, string policySetName, string name, string expand = default(string)) + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IPoliciesOperations operations, string labName, string policySetName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, policySetName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(labName, policySetName, name, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Get policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + public static Policy Get(this IPoliciesOperations operations, string labName, string policySetName, string name, string expand = default(string)) + { + return ((IPoliciesOperations)operations).GetAsync(labName, policySetName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Get policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// The name of the policy. - /// - /// - /// Specify the $expand query. Example: 'properties($select=description)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, policySetName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, policySetName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Create or replace an existing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + public static Policy CreateOrUpdate(this IPoliciesOperations operations, string labName, string policySetName, string name, Policy policy) + { + return ((IPoliciesOperations)operations).CreateOrUpdateAsync(labName, policySetName, name, policy).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// The name of the policy. - /// - /// - /// A Policy. - /// - public static Policy CreateOrUpdate(this IPoliciesOperations operations, string labName, string policySetName, string name, Policy policy) + /// + /// Create or replace an existing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, Policy policy, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(labName, policySetName, name, policy).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Delete policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + public static void Delete(this IPoliciesOperations operations, string labName, string policySetName, string name) + { + ((IPoliciesOperations)operations).DeleteAsync(labName, policySetName, name).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// The name of the policy. - /// - /// - /// A Policy. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, Policy policy, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// The name of the policy. - /// - public static void Delete(this IPoliciesOperations operations, string labName, string policySetName, string name) - { - operations.DeleteAsync(labName, policySetName, name).GetAwaiter().GetResult(); - } + /// + /// Delete policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, policySetName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + public static Policy Update(this IPoliciesOperations operations, string labName, string policySetName, string name, PolicyFragment policy) + { + return ((IPoliciesOperations)operations).UpdateAsync(labName, policySetName, name, policy).GetAwaiter().GetResult(); + } - /// - /// Delete policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// The name of the policy. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Modify properties of policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, PolicyFragment policy, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, policySetName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IPoliciesOperations operations, string nextPageLink) + { + return ((IPoliciesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Modify properties of policies. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// The name of the policy. - /// - /// - /// A Policy. - /// - public static Policy Update(this IPoliciesOperations operations, string labName, string policySetName, string name, PolicyFragment policy) + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IPoliciesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(labName, policySetName, name, policy).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Modify properties of policies. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// The name of the policy. - /// - /// - /// A Policy. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, PolicyFragment policy, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List policies in a given policy set. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IPoliciesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List policies in a given policy 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 IPoliciesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs index f6f87d9f07c6..7ea694dea180 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// PolicySetsOperations operations. /// - internal partial class PolicySetsOperations : IServiceOperations, IPolicySetsOperations + internal partial class PolicySetsOperations : Microsoft.Rest.IServiceOperations, IPolicySetsOperations { /// /// Initializes a new instance of the PolicySetsOperations class. @@ -36,13 +24,13 @@ internal partial class PolicySetsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal PolicySetsOperations(DevTestLabsClient client) + internal PolicySetsOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -68,13 +56,13 @@ internal PolicySetsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -83,81 +71,94 @@ internal PolicySetsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> EvaluatePoliciesWithHttpMessagesAsync(string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> EvaluatePoliciesWithHttpMessagesAsync(string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (evaluatePoliciesRequest == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "evaluatePoliciesRequest"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (evaluatePoliciesRequest == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "evaluatePoliciesRequest"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("evaluatePoliciesRequest", evaluatePoliciesRequest); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "EvaluatePolicies", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "EvaluatePolicies", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -169,61 +170,62 @@ internal PolicySetsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(evaluatePoliciesRequest != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(evaluatePoliciesRequest, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(evaluatePoliciesRequest, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -233,9 +235,10 @@ internal PolicySetsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -246,24 +249,28 @@ internal PolicySetsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs index 28e99c588e53..fefddc56c986 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs @@ -1,71 +1,55 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for PolicySetsOperations. + /// Extension methods for PolicySetsOperations /// public static partial class PolicySetsOperationsExtensions { - /// - /// Evaluates lab policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// Request body for evaluating a policy set. - /// - public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetsOperations operations, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest) - { - return operations.EvaluatePoliciesAsync(labName, name, evaluatePoliciesRequest).GetAwaiter().GetResult(); - } + /// + /// Evaluates lab policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetsOperations operations, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest) + { + return ((IPolicySetsOperations)operations).EvaluatePoliciesAsync(labName, name, evaluatePoliciesRequest).GetAwaiter().GetResult(); + } - /// - /// Evaluates lab policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the policy set. - /// - /// - /// Request body for evaluating a policy set. - /// - /// - /// The cancellation token. - /// - public static async Task EvaluatePoliciesAsync(this IPolicySetsOperations operations, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Evaluates lab policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task EvaluatePoliciesAsync(this IPolicySetsOperations operations, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.EvaluatePoliciesWithHttpMessagesAsync(labName, name, evaluatePoliciesRequest, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.EvaluatePoliciesWithHttpMessagesAsync(labName, name, evaluatePoliciesRequest, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs index c176c9e44add..dc756db7f657 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// ProviderOperations operations. /// - internal partial class ProviderOperations : IServiceOperations, IProviderOperations + internal partial class ProviderOperations : Microsoft.Rest.IServiceOperations, IProviderOperations { /// /// Initializes a new instance of the ProviderOperations class. @@ -36,13 +24,13 @@ internal partial class ProviderOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ProviderOperations(DevTestLabsClient client) + internal ProviderOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -59,13 +47,13 @@ internal ProviderOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -74,54 +62,62 @@ internal ProviderOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) + + + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.DevTestLab/operations").ToString(); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -133,55 +129,56 @@ internal ProviderOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -191,9 +188,10 @@ internal ProviderOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -204,25 +202,29 @@ internal ProviderOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Result of the request to list REST API operations /// @@ -235,13 +237,13 @@ internal ProviderOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -250,51 +252,54 @@ internal ProviderOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -306,55 +311,56 @@ internal ProviderOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -364,9 +370,10 @@ internal ProviderOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -377,24 +384,28 @@ internal ProviderOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs index 28ef5bf7374d..0a70971db733 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs @@ -1,87 +1,76 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for ProviderOperations. + /// Extension methods for ProviderOperations /// public static partial class ProviderOperationsExtensions { - /// - /// Result of the request to list REST API operations - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IProviderOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } + /// + /// Result of the request to list REST API operations + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IProviderOperations operations) + { + return ((IProviderOperations)operations).ListAsync().GetAwaiter().GetResult(); + } - /// - /// Result of the request to list REST API operations - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IProviderOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Result of the request to list REST API operations + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IProviderOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Result of the request to list REST API operations + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IProviderOperations operations, string nextPageLink) + { + return ((IProviderOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Result of the request to list REST API operations - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IProviderOperations operations, string nextPageLink) + /// + /// Result of the request to list REST API operations + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IProviderOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Result of the request to list REST API operations - /// - /// - /// 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 IProviderOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs index 68eb07a7fb9c..5ad54ac2202e 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// SchedulesOperations operations. /// - internal partial class SchedulesOperations : IServiceOperations, ISchedulesOperations + internal partial class SchedulesOperations : Microsoft.Rest.IServiceOperations, ISchedulesOperations { /// /// Initializes a new instance of the SchedulesOperations class. @@ -37,13 +24,13 @@ internal partial class SchedulesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal SchedulesOperations(DevTestLabsClient client) + internal SchedulesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// List schedules in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _schedule = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_schedule)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_schedule); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal SchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get schedule. /// @@ -265,7 +270,7 @@ internal SchedulesOperations(DevTestLabsClient client) /// The name of the schedule. /// /// - /// Specify the $expand query. Example: 'properties($select=status)' + /// Specify the $expand query. Example: 'properties($select=status)' /// /// /// Headers that will be added to request. @@ -273,13 +278,13 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -288,81 +293,94 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -374,55 +392,56 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -432,9 +451,10 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -445,25 +465,29 @@ internal SchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing schedule. /// @@ -482,13 +506,13 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -497,81 +521,94 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (schedule == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (schedule == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -583,61 +620,62 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(schedule != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -647,9 +685,10 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -660,16 +699,16 @@ internal SchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -678,25 +717,29 @@ internal SchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete schedule. /// @@ -712,10 +755,10 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -724,76 +767,88 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -805,55 +860,56 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -863,20 +919,25 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Modify properties of schedules. /// @@ -895,13 +956,13 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -910,81 +971,93 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string labName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (schedule == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); } - if (Client.ResourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (schedule == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -996,61 +1069,62 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(schedule != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1060,9 +1134,10 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1073,25 +1148,29 @@ internal SchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Execute a schedule. This operation can take a while to complete. /// @@ -1102,16 +1181,16 @@ internal SchedulesOperations(DevTestLabsClient client) /// The name of the schedule. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task ExecuteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -1129,13 +1208,13 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1144,76 +1223,88 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListApplicableWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListApplicableWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListApplicable", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListApplicable", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1225,55 +1316,56 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1283,9 +1375,10 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1296,25 +1389,29 @@ internal SchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Execute a schedule. This operation can take a while to complete. /// @@ -1330,10 +1427,10 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1342,76 +1439,88 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginExecuteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1423,55 +1532,56 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1481,20 +1591,25 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List schedules in a given lab. /// @@ -1507,13 +1622,13 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1522,51 +1637,54 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1578,55 +1696,56 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1636,9 +1755,10 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1649,25 +1769,29 @@ internal SchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists all applicable schedules /// @@ -1680,13 +1804,13 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1695,51 +1819,54 @@ internal SchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListApplicableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListApplicableNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListApplicableNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListApplicableNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1751,55 +1878,56 @@ internal SchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1809,9 +1937,10 @@ internal SchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1822,24 +1951,28 @@ internal SchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs index 88ceac2ea83c..15a2117f1275 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs @@ -1,423 +1,391 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for SchedulesOperations. + /// Extension methods for SchedulesOperations /// public static partial class SchedulesOperationsExtensions { - /// - /// List schedules in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this ISchedulesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this ISchedulesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ISchedulesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// List schedules in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISchedulesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ISchedulesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this ISchedulesOperations operations, string labName, string name, string expand = default(string)) + { + return ((ISchedulesOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Get schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - public static Schedule Get(this ISchedulesOperations operations, string labName, string name, string expand = default(string)) + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ISchedulesOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static Schedule CreateOrUpdate(this ISchedulesOperations operations, string labName, string name, Schedule schedule) + { + return ((ISchedulesOperations)operations).CreateOrUpdateAsync(labName, name, schedule).GetAwaiter().GetResult(); + } - /// - /// Get schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISchedulesOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ISchedulesOperations operations, string labName, string name, Schedule schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this ISchedulesOperations operations, string labName, string name) + { + ((ISchedulesOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - public static Schedule CreateOrUpdate(this ISchedulesOperations operations, string labName, string name, Schedule schedule) - { - return operations.CreateOrUpdateAsync(labName, name, schedule).GetAwaiter().GetResult(); - } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ISchedulesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static Schedule Update(this ISchedulesOperations operations, string labName, string name, ScheduleFragment schedule) + { + return ((ISchedulesOperations)operations).UpdateAsync(labName, name, schedule).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ISchedulesOperations operations, string labName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ISchedulesOperations operations, string labName, string name, ScheduleFragment schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this ISchedulesOperations operations, string labName, string name) + { + ((ISchedulesOperations)operations).ExecuteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Delete schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - public static void Delete(this ISchedulesOperations operations, string labName, string name) - { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); - } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ExecuteAsync(this ISchedulesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static Microsoft.Rest.Azure.IPage ListApplicable(this ISchedulesOperations operations, string labName, string name) + { + return ((ISchedulesOperations)operations).ListApplicableAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Delete schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ISchedulesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListApplicableAsync(this ISchedulesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListApplicableWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this ISchedulesOperations operations, string labName, string name) + { + ((ISchedulesOperations)operations).BeginExecuteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Modify properties of schedules. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - public static Schedule Update(this ISchedulesOperations operations, string labName, string name, ScheduleFragment schedule) - { - return operations.UpdateAsync(labName, name, schedule).GetAwaiter().GetResult(); - } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginExecuteAsync(this ISchedulesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this ISchedulesOperations operations, string nextPageLink) + { + return ((ISchedulesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Modify properties of schedules. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ISchedulesOperations operations, string labName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this ISchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListApplicableNext(this ISchedulesOperations operations, string nextPageLink) + { + return ((ISchedulesOperations)operations).ListApplicableNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - public static void Execute(this ISchedulesOperations operations, string labName, string name) + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListApplicableNextAsync(this ISchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListApplicableNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - operations.ExecuteAsync(labName, name).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteAsync(this ISchedulesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ExecuteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Lists all applicable schedules - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - public static IPage ListApplicable(this ISchedulesOperations operations, string labName, string name) - { - return operations.ListApplicableAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Lists all applicable schedules - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task> ListApplicableAsync(this ISchedulesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListApplicableWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - public static void BeginExecute(this ISchedulesOperations operations, string labName, string name) - { - operations.BeginExecuteAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task BeginExecuteAsync(this ISchedulesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginExecuteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List schedules in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISchedulesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List schedules in a given lab. - /// - /// - /// 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 ISchedulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists all applicable schedules - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListApplicableNext(this ISchedulesOperations operations, string nextPageLink) - { - return operations.ListApplicableNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists all applicable schedules - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListApplicableNextAsync(this ISchedulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListApplicableNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs deleted file mode 100644 index 5055a941c9c3..000000000000 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SdkInfo_DevTestLabsClient.cs +++ /dev/null @@ -1,49 +0,0 @@ - -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DevTestLabs -{ - using System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_DevTestLabsClient - { - get - { - return new Tuple[] - { - new Tuple("DevTestLab", "ArmTemplates", "2016-05-15"), - new Tuple("DevTestLab", "ArtifactSources", "2016-05-15"), - new Tuple("DevTestLab", "Artifacts", "2016-05-15"), - new Tuple("DevTestLab", "Costs", "2016-05-15"), - new Tuple("DevTestLab", "CustomImages", "2016-05-15"), - new Tuple("DevTestLab", "Disks", "2016-05-15"), - new Tuple("DevTestLab", "Environments", "2016-05-15"), - new Tuple("DevTestLab", "Formulas", "2016-05-15"), - new Tuple("DevTestLab", "GalleryImages", "2016-05-15"), - new Tuple("DevTestLab", "GlobalSchedules", "2016-05-15"), - new Tuple("DevTestLab", "Labs", "2016-05-15"), - new Tuple("DevTestLab", "NotificationChannels", "2016-05-15"), - new Tuple("DevTestLab", "Operations", "2016-05-15"), - new Tuple("DevTestLab", "Policies", "2016-05-15"), - new Tuple("DevTestLab", "PolicySets", "2016-05-15"), - new Tuple("DevTestLab", "ProviderOperations", "2016-05-15"), - new Tuple("DevTestLab", "Schedules", "2016-05-15"), - new Tuple("DevTestLab", "Secrets", "2016-05-15"), - new Tuple("DevTestLab", "ServiceRunners", "2016-05-15"), - new Tuple("DevTestLab", "Users", "2016-05-15"), - new Tuple("DevTestLab", "VirtualMachineSchedules", "2016-05-15"), - new Tuple("DevTestLab", "VirtualMachines", "2016-05-15"), - new Tuple("DevTestLab", "VirtualNetworks", "2016-05-15"), - }.AsEnumerable(); - } - } - } -} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs index aeb99cd36e7c..1c4eb72b7812 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// SecretsOperations operations. /// - internal partial class SecretsOperations : IServiceOperations, ISecretsOperations + internal partial class SecretsOperations : Microsoft.Rest.IServiceOperations, ISecretsOperations { /// /// Initializes a new instance of the SecretsOperations class. @@ -37,13 +24,13 @@ internal partial class SecretsOperations : IServiceOperations /// /// Thrown when a required parameter is null /// - internal SecretsOperations(DevTestLabsClient client) + internal SecretsOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,28 +41,28 @@ internal SecretsOperations(DevTestLabsClient client) /// /// List secrets in a given user profile. /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the user profile. /// - /// - /// 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 /// /// @@ -84,85 +71,98 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, string userName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _secret = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_secret)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_secret); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -174,55 +174,56 @@ internal SecretsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -232,9 +233,10 @@ internal SecretsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -245,25 +247,29 @@ internal SecretsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get secret. /// @@ -277,7 +283,7 @@ internal SecretsOperations(DevTestLabsClient client) /// The name of the secret. /// /// - /// Specify the $expand query. Example: 'properties($select=value)' + /// Specify the $expand query. Example: 'properties($select=value)' /// /// /// Headers that will be added to request. @@ -285,13 +291,13 @@ internal SecretsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -300,87 +306,101 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -392,55 +412,56 @@ internal SecretsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -450,9 +471,10 @@ internal SecretsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -463,25 +485,29 @@ internal SecretsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing secret. /// @@ -503,13 +529,13 @@ internal SecretsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -518,87 +544,101 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Secret secret, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Secret secret, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (secret == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "secret"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (secret == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "secret"); - } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); + tracingParameters.Add("secret", secret); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -610,61 +650,62 @@ internal SecretsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(secret != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(secret, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(secret, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -674,9 +715,10 @@ internal SecretsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -687,16 +729,16 @@ internal SecretsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -705,25 +747,29 @@ internal SecretsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete secret. /// @@ -742,10 +788,10 @@ internal SecretsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -754,82 +800,95 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -841,55 +900,56 @@ internal SecretsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -899,20 +959,25 @@ internal SecretsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List secrets in a given user profile. /// @@ -925,13 +990,13 @@ internal SecretsOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -940,51 +1005,54 @@ internal SecretsOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -996,55 +1064,56 @@ internal SecretsOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1054,9 +1123,10 @@ internal SecretsOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1067,24 +1137,28 @@ internal SecretsOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs index 1f4208e9e918..9f852b82932d 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs @@ -1,253 +1,232 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for SecretsOperations. + /// Extension methods for SecretsOperations /// public static partial class SecretsOperationsExtensions { - /// - /// List secrets in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this ISecretsOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List secrets in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISecretsOperations operations, string labName, string userName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get secret. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// Specify the $expand query. Example: 'properties($select=value)' - /// - public static Secret Get(this ISecretsOperations operations, string labName, string userName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); - } + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static Microsoft.Rest.Azure.IPage List(this ISecretsOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ISecretsOperations)operations).ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get secret. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// Specify the $expand query. Example: 'properties($select=value)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISecretsOperations operations, string labName, string userName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ISecretsOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + public static Secret Get(this ISecretsOperations operations, string labName, string userName, string name, string expand = default(string)) + { + return ((ISecretsOperations)operations).GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing secret. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// A secret. - /// - public static Secret CreateOrUpdate(this ISecretsOperations operations, string labName, string userName, string name, Secret secret) + /// + /// Get secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ISecretsOperations operations, string labName, string userName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(labName, userName, name, secret).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + public static Secret CreateOrUpdate(this ISecretsOperations operations, string labName, string userName, string name, Secret secret) + { + return ((ISecretsOperations)operations).CreateOrUpdateAsync(labName, userName, name, secret).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing secret. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// A secret. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ISecretsOperations operations, string labName, string userName, string name, Secret secret, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ISecretsOperations operations, string labName, string userName, string name, Secret secret, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + public static void Delete(this ISecretsOperations operations, string labName, string userName, string name) + { + ((ISecretsOperations)operations).DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } - /// - /// Delete secret. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - public static void Delete(this ISecretsOperations operations, string labName, string userName, string name) - { - operations.DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete secret. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The name of the secret. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ISecretsOperations operations, string labName, string userName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// Delete secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ISecretsOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this ISecretsOperations operations, string nextPageLink) + { + return ((ISecretsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// List secrets in a given user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISecretsOperations operations, string nextPageLink) + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this ISecretsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// List secrets in a given user profile. - /// - /// - /// 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 ISecretsOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs index 4c9d86d77c66..5ddcbdf568d6 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// ServiceRunnersOperations operations. /// - internal partial class ServiceRunnersOperations : IServiceOperations, IServiceRunnersOperations + internal partial class ServiceRunnersOperations : Microsoft.Rest.IServiceOperations, IServiceRunnersOperations { /// /// Initializes a new instance of the ServiceRunnersOperations class. @@ -37,13 +24,13 @@ internal partial class ServiceRunnersOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ServiceRunnersOperations(DevTestLabsClient client) + internal ServiceRunnersOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// List service runners in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _serviceRunner = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_serviceRunner)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_serviceRunner); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal ServiceRunnersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get service runner. /// @@ -270,13 +275,13 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -285,76 +290,88 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -366,55 +383,56 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -424,9 +442,10 @@ internal ServiceRunnersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -437,25 +456,29 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing Service runner. /// @@ -474,13 +497,13 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -489,81 +512,94 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ServiceRunner serviceRunner, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ServiceRunner serviceRunner, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (serviceRunner == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "serviceRunner"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (serviceRunner == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceRunner"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("serviceRunner", serviceRunner); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -575,61 +611,62 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(serviceRunner != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(serviceRunner, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(serviceRunner, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -639,9 +676,10 @@ internal ServiceRunnersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -652,16 +690,16 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -670,25 +708,29 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete service runner. /// @@ -704,10 +746,10 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -716,76 +758,88 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -797,55 +851,56 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -855,20 +910,25 @@ internal ServiceRunnersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List service runners in a given lab. /// @@ -881,13 +941,13 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -896,51 +956,54 @@ internal ServiceRunnersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -952,55 +1015,56 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1010,9 +1074,10 @@ internal ServiceRunnersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1023,24 +1088,28 @@ internal ServiceRunnersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs index ce5de9e0f812..547f4aa3fac8 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs @@ -1,223 +1,202 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for ServiceRunnersOperations. + /// Extension methods for ServiceRunnersOperations /// public static partial class ServiceRunnersOperationsExtensions { - /// - /// List service runners in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IServiceRunnersOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List service runners in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IServiceRunnersOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get service runner. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the service runner. - /// - public static ServiceRunner Get(this IServiceRunnersOperations operations, string labName, string name) - { - return operations.GetAsync(labName, name).GetAwaiter().GetResult(); - } + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IServiceRunnersOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IServiceRunnersOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get service runner. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the service runner. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IServiceRunnersOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IServiceRunnersOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + public static ServiceRunner Get(this IServiceRunnersOperations operations, string labName, string name) + { + return ((IServiceRunnersOperations)operations).GetAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing Service runner. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the service runner. - /// - /// - /// A container for a managed identity to execute DevTest lab services. - /// - public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operations, string labName, string name, ServiceRunner serviceRunner) + /// + /// Get service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IServiceRunnersOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(labName, name, serviceRunner).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing Service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operations, string labName, string name, ServiceRunner serviceRunner) + { + return ((IServiceRunnersOperations)operations).CreateOrUpdateAsync(labName, name, serviceRunner).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing Service runner. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the service runner. - /// - /// - /// A container for a managed identity to execute DevTest lab services. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IServiceRunnersOperations operations, string labName, string name, ServiceRunner serviceRunner, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing Service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IServiceRunnersOperations operations, string labName, string name, ServiceRunner serviceRunner, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, serviceRunner, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, serviceRunner, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + public static void Delete(this IServiceRunnersOperations operations, string labName, string name) + { + ((IServiceRunnersOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Delete service runner. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the service runner. - /// - public static void Delete(this IServiceRunnersOperations operations, string labName, string name) - { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete service runner. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the service runner. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IServiceRunnersOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// Delete service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IServiceRunnersOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IServiceRunnersOperations operations, string nextPageLink) + { + return ((IServiceRunnersOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// List service runners in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IServiceRunnersOperations operations, string nextPageLink) + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IServiceRunnersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// List service runners in a given lab. - /// - /// - /// 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 IServiceRunnersOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs index 62821da17e3c..4f397d4ccc84 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// UsersOperations operations. /// - internal partial class UsersOperations : IServiceOperations, IUsersOperations + internal partial class UsersOperations : Microsoft.Rest.IServiceOperations, IUsersOperations { /// /// Initializes a new instance of the UsersOperations class. @@ -37,13 +24,13 @@ internal partial class UsersOperations : IServiceOperations, /// /// Thrown when a required parameter is null /// - internal UsersOperations(DevTestLabsClient client) + internal UsersOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal UsersOperations(DevTestLabsClient client) /// /// List user profiles in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _user = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_user)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_user); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal UsersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal UsersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal UsersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get user profile. /// @@ -265,7 +270,7 @@ internal UsersOperations(DevTestLabsClient client) /// The name of the user profile. /// /// - /// Specify the $expand query. Example: 'properties($select=identity)' + /// Specify the $expand query. Example: 'properties($select=identity)' /// /// /// Headers that will be added to request. @@ -273,13 +278,13 @@ internal UsersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -288,81 +293,94 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -374,55 +392,56 @@ internal UsersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -432,9 +451,10 @@ internal UsersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -445,25 +465,29 @@ internal UsersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing user profile. /// @@ -482,13 +506,13 @@ internal UsersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -497,81 +521,94 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, User user, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (user == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "user"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (user == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "user"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("user", user); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -583,61 +620,62 @@ internal UsersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(user != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(user, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(user, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -647,9 +685,10 @@ internal UsersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -660,16 +699,16 @@ internal UsersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -678,25 +717,29 @@ internal UsersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete user profile. This operation can take a while to complete. /// @@ -707,16 +750,16 @@ internal UsersOperations(DevTestLabsClient client) /// The name of the user profile. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -737,13 +780,13 @@ internal UsersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -752,81 +795,93 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string labName, string name, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, UserFragment user, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (user == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "user"); } - if (Client.ResourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (user == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "user"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("user", user); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -838,61 +893,62 @@ internal UsersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(user != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(user, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(user, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -902,9 +958,10 @@ internal UsersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -915,25 +972,29 @@ internal UsersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete user profile. This operation can take a while to complete. /// @@ -949,10 +1010,10 @@ internal UsersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -961,76 +1022,88 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1042,55 +1115,56 @@ internal UsersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1100,20 +1174,25 @@ internal UsersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List user profiles in a given lab. /// @@ -1126,13 +1205,13 @@ internal UsersOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1141,51 +1220,54 @@ internal UsersOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1197,55 +1279,56 @@ internal UsersOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1255,9 +1338,10 @@ internal UsersOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1268,24 +1352,28 @@ internal UsersOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs index 1e378fdd80b9..50413a9f69b1 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs @@ -1,312 +1,283 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for UsersOperations. + /// Extension methods for UsersOperations /// public static partial class UsersOperationsExtensions { - /// - /// List user profiles in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IUsersOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List user profiles in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IUsersOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Specify the $expand query. Example: 'properties($select=identity)' - /// - public static User Get(this IUsersOperations operations, string labName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Specify the $expand query. Example: 'properties($select=identity)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IUsersOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Profile of a lab user. - /// - public static User CreateOrUpdate(this IUsersOperations operations, string labName, string name, User user) - { - return operations.CreateOrUpdateAsync(labName, name, user).GetAwaiter().GetResult(); - } + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IUsersOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IUsersOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing user profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Profile of a lab user. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IUsersOperations operations, string labName, string name, User user, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IUsersOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, user, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + public static User Get(this IUsersOperations operations, string labName, string name, string expand = default(string)) + { + return ((IUsersOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Delete user profile. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - public static void Delete(this IUsersOperations operations, string labName, string name) + /// + /// Get user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IUsersOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static User CreateOrUpdate(this IUsersOperations operations, string labName, string name, User user) + { + return ((IUsersOperations)operations).CreateOrUpdateAsync(labName, name, user).GetAwaiter().GetResult(); + } - /// - /// Delete user profile. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IUsersOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IUsersOperations operations, string labName, string name, User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, user, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static void Delete(this IUsersOperations operations, string labName, string name) + { + ((IUsersOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Modify properties of user profiles. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Profile of a lab user. - /// - public static User Update(this IUsersOperations operations, string labName, string name, UserFragment user) - { - return operations.UpdateAsync(labName, name, user).GetAwaiter().GetResult(); - } + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IUsersOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of user profiles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static User Update(this IUsersOperations operations, string labName, string name, UserFragment user) + { + return ((IUsersOperations)operations).UpdateAsync(labName, name, user).GetAwaiter().GetResult(); + } - /// - /// Modify properties of user profiles. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// Profile of a lab user. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IUsersOperations operations, string labName, string name, UserFragment user, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Modify properties of user profiles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IUsersOperations operations, string labName, string name, UserFragment user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, user, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, user, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static void BeginDelete(this IUsersOperations operations, string labName, string name) + { + ((IUsersOperations)operations).BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Delete user profile. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - public static void BeginDelete(this IUsersOperations operations, string labName, string name) - { - operations.BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); - } + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IUsersOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IUsersOperations operations, string nextPageLink) + { + return ((IUsersOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Delete user profile. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user profile. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IUsersOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IUsersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// List user profiles in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IUsersOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List user profiles in a given lab. - /// - /// - /// 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 IUsersOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs index bc8a484b70a2..ed07f41c89df 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// VirtualMachineSchedulesOperations operations. /// - internal partial class VirtualMachineSchedulesOperations : IServiceOperations, IVirtualMachineSchedulesOperations + internal partial class VirtualMachineSchedulesOperations : Microsoft.Rest.IServiceOperations, IVirtualMachineSchedulesOperations { /// /// Initializes a new instance of the VirtualMachineSchedulesOperations class. @@ -37,13 +24,13 @@ internal partial class VirtualMachineSchedulesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal VirtualMachineSchedulesOperations(DevTestLabsClient client) + internal VirtualMachineSchedulesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,28 +41,28 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// List schedules in a given virtual machine. /// + /// + /// + /// /// /// The name of the lab. /// /// /// The name of the virtual machine. /// - /// - /// 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 /// /// @@ -84,85 +71,98 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string virtualMachineName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _schedule = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_schedule)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_schedule); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -174,55 +174,56 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -232,9 +233,10 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -245,25 +247,29 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get schedule. /// @@ -277,7 +283,7 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// The name of the schedule. /// /// - /// Specify the $expand query. Example: 'properties($select=status)' + /// Specify the $expand query. Example: 'properties($select=status)' /// /// /// Headers that will be added to request. @@ -285,13 +291,13 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -300,87 +306,101 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string virtualMachineName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string virtualMachineName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -392,55 +412,56 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -450,9 +471,10 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -463,25 +485,29 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing schedule. /// @@ -503,13 +529,13 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -518,87 +544,101 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Schedule schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (schedule == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (schedule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); - } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -610,61 +650,62 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(schedule != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -674,9 +715,10 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -687,16 +729,16 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -705,25 +747,29 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete schedule. /// @@ -742,10 +788,10 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -754,82 +800,95 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -841,55 +900,56 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -899,20 +959,25 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Modify properties of schedules. /// @@ -934,13 +999,13 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -949,87 +1014,100 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, ScheduleFragment schedule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (schedule == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); + } + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (schedule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "schedule"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); + tracingParameters.Add("schedule", schedule); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1041,61 +1119,62 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(schedule != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1105,9 +1184,10 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1118,25 +1198,29 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Execute a schedule. This operation can take a while to complete. /// @@ -1150,16 +1234,16 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// The name of the schedule. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task ExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -1180,10 +1264,10 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1192,82 +1276,95 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1279,55 +1376,56 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1337,20 +1435,25 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List schedules in a given virtual machine. /// @@ -1363,13 +1466,13 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1378,51 +1481,54 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1434,55 +1540,56 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1492,9 +1599,10 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1505,24 +1613,28 @@ internal VirtualMachineSchedulesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs index d7037f393f6a..caa120928e50 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs @@ -1,391 +1,361 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for VirtualMachineSchedulesOperations. + /// Extension methods for VirtualMachineSchedulesOperations /// public static partial class VirtualMachineSchedulesOperationsExtensions { - /// - /// List schedules in a given virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, virtualMachineName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List schedules in a given virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, virtualMachineName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - public static Schedule Get(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, virtualMachineName, name, expand).GetAwaiter().GetResult(); - } + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static Microsoft.Rest.Azure.IPage List(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IVirtualMachineSchedulesOperations)operations).ListAsync(labName, virtualMachineName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// Get schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, virtualMachineName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, virtualMachineName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, string expand = default(string)) + { + return ((IVirtualMachineSchedulesOperations)operations).GetAsync(labName, virtualMachineName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, Schedule schedule) + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, virtualMachineName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, Schedule schedule) + { + return ((IVirtualMachineSchedulesOperations)operations).CreateOrUpdateAsync(labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, Schedule schedule, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, Schedule schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) + { + ((IVirtualMachineSchedulesOperations)operations).DeleteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); + } - /// - /// Delete schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - public static void Delete(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) - { - operations.DeleteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); - } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static Schedule Update(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, ScheduleFragment schedule) + { + return ((IVirtualMachineSchedulesOperations)operations).UpdateAsync(labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + } - /// - /// Delete schedule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, ScheduleFragment schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) + { + ((IVirtualMachineSchedulesOperations)operations).ExecuteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); + } - /// - /// Modify properties of schedules. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - public static Schedule Update(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, ScheduleFragment schedule) - { - return operations.UpdateAsync(labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); - } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ExecuteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) + { + ((IVirtualMachineSchedulesOperations)operations).BeginExecuteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); + } - /// - /// Modify properties of schedules. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// A schedule. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, ScheduleFragment schedule, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginExecuteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IVirtualMachineSchedulesOperations operations, string nextPageLink) + { + return ((IVirtualMachineSchedulesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - public static void Execute(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) + /// + /// List schedules in a given 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 System.Threading.Tasks.Task> ListNextAsync(this IVirtualMachineSchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - operations.ExecuteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - public static void BeginExecute(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) - { - operations.BeginExecuteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); - } - - /// - /// Execute a schedule. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The name of the schedule. - /// - /// - /// The cancellation token. - /// - public static async Task BeginExecuteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List schedules in a given virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IVirtualMachineSchedulesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List schedules in a given 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> ListNextAsync(this IVirtualMachineSchedulesOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs index 4b8815079797..b40892710b4a 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// VirtualMachinesOperations operations. /// - internal partial class VirtualMachinesOperations : IServiceOperations, IVirtualMachinesOperations + internal partial class VirtualMachinesOperations : Microsoft.Rest.IServiceOperations, IVirtualMachinesOperations { /// /// Initializes a new instance of the VirtualMachinesOperations class. @@ -37,13 +24,13 @@ internal partial class VirtualMachinesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal VirtualMachinesOperations(DevTestLabsClient client) + internal VirtualMachinesOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// List virtual machines in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _labVirtualMachine = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_labVirtualMachine)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_labVirtualMachine); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get virtual machine. /// @@ -266,7 +271,7 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// /// Specify the $expand query. Example: - /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' /// /// /// Headers that will be added to request. @@ -274,13 +279,13 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -289,81 +294,94 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -375,55 +393,56 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -433,9 +452,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -446,25 +466,29 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing Virtual machine. This operation can take a /// while to complete. @@ -479,16 +503,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// A virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -501,16 +525,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// The name of the virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -531,13 +555,13 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -546,81 +570,93 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachineFragment labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachineFragment labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (labVirtualMachine == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labVirtualMachine"); } - if (Client.ResourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (labVirtualMachine == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labVirtualMachine"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("labVirtualMachine", labVirtualMachine); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -632,61 +668,62 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(labVirtualMachine != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -696,9 +733,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -709,25 +747,29 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Attach a new or existing data disk to virtual machine. This operation can /// take a while to complete. @@ -742,16 +784,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// Request body for adding a new or existing data disk to a virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task AddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task AddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginAddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginAddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -768,16 +810,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// Request body for applying artifacts to a virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task ApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task ApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -791,16 +833,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// The name of the virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task ClaimWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task ClaimWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginClaimWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginClaimWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -817,16 +859,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// Request body for detaching data disk from a virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -844,13 +886,13 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -859,76 +901,88 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListApplicableSchedulesWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ListApplicableSchedulesWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListApplicableSchedules", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListApplicableSchedules", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -940,55 +994,56 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -998,9 +1053,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1011,25 +1067,29 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Start a virtual machine. This operation can take a while to complete. /// @@ -1040,16 +1100,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// The name of the virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task StartWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task StartWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -1062,16 +1122,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// The name of the virtual machine. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task StopWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task StopWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -1093,13 +1153,13 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1108,81 +1168,94 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (labVirtualMachine == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labVirtualMachine"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (labVirtualMachine == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labVirtualMachine"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("labVirtualMachine", labVirtualMachine); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1194,61 +1267,62 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(labVirtualMachine != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1258,9 +1332,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1271,16 +1346,16 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -1289,25 +1364,29 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete virtual machine. This operation can take a while to complete. /// @@ -1323,10 +1402,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1335,76 +1414,88 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1416,55 +1507,56 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1474,20 +1566,25 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Attach a new or existing data disk to virtual machine. This operation can /// take a while to complete. @@ -1507,10 +1604,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1519,81 +1616,94 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginAddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginAddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (dataDiskProperties == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dataDiskProperties"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (dataDiskProperties == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "dataDiskProperties"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("dataDiskProperties", dataDiskProperties); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginAddDataDisk", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginAddDataDisk", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1605,61 +1715,62 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(dataDiskProperties != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataDiskProperties, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(dataDiskProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1669,20 +1780,25 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Apply artifacts to virtual machine. This operation can take a while to /// complete. @@ -1702,10 +1818,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1714,81 +1830,94 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (applyArtifactsRequest == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applyArtifactsRequest"); + } + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (applyArtifactsRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "applyArtifactsRequest"); - } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("applyArtifactsRequest", applyArtifactsRequest); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginApplyArtifacts", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginApplyArtifacts", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1800,61 +1929,62 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(applyArtifactsRequest != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(applyArtifactsRequest, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(applyArtifactsRequest, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1864,20 +1994,25 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Take ownership of an existing virtual machine This operation can take a /// while to complete. @@ -1894,10 +2029,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1906,76 +2041,88 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginClaimWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginClaimWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginClaim", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginClaim", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1987,55 +2134,56 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2045,20 +2193,25 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Detach the specified disk from the virtual machine. This operation can take /// a while to complete. @@ -2078,10 +2231,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2090,81 +2243,94 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (detachDataDiskProperties == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "detachDataDiskProperties"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (detachDataDiskProperties == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "detachDataDiskProperties"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("detachDataDiskProperties", detachDataDiskProperties); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDetachDataDisk", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDetachDataDisk", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2176,61 +2342,62 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(detachDataDiskProperties != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(detachDataDiskProperties, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(detachDataDiskProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2240,20 +2407,25 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Start a virtual machine. This operation can take a while to complete. /// @@ -2269,10 +2441,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2281,76 +2453,88 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginStartWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginStartWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2362,55 +2546,56 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2420,20 +2605,25 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Stop a virtual machine This operation can take a while to complete. /// @@ -2449,10 +2639,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2461,76 +2651,88 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginStopWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginStopWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginStop", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginStop", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2542,55 +2744,56 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2600,20 +2803,25 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List virtual machines in a given lab. /// @@ -2626,13 +2834,13 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2641,51 +2849,54 @@ internal VirtualMachinesOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2697,55 +2908,56 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2755,9 +2967,10 @@ internal VirtualMachinesOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2768,24 +2981,28 @@ internal VirtualMachinesOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs index 41162ddce27c..ad4d9df44901 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs @@ -1,900 +1,815 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for VirtualMachinesOperations. + /// Extension methods for VirtualMachinesOperations /// public static partial class VirtualMachinesOperationsExtensions { - /// - /// List virtual machines in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IVirtualMachinesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List virtual machines in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IVirtualMachinesOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' - /// - public static LabVirtualMachine Get(this IVirtualMachinesOperations operations, string labName, string name, string expand = default(string)) - { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); - } - - /// - /// Get virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IVirtualMachinesOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing Virtual machine. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// A virtual machine. - /// - public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine) - { - return operations.CreateOrUpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing Virtual machine. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// A virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void Delete(this IVirtualMachinesOperations operations, string labName, string name) - { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of virtual machines. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// A virtual machine. - /// - public static LabVirtualMachine Update(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachineFragment labVirtualMachine) - { - return operations.UpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of virtual machines. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// A virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachineFragment labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Attach a new or existing data disk to virtual machine. This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for adding a new or existing data disk to a virtual machine. - /// - public static void AddDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties) - { - operations.AddDataDiskAsync(labName, name, dataDiskProperties).GetAwaiter().GetResult(); - } - - /// - /// Attach a new or existing data disk to virtual machine. This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for adding a new or existing data disk to a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task AddDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.AddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Apply artifacts to virtual machine. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for applying artifacts to a virtual machine. - /// - public static void ApplyArtifacts(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) - { - operations.ApplyArtifactsAsync(labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); - } - - /// - /// Apply artifacts to virtual machine. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for applying artifacts to a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task ApplyArtifactsAsync(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Take ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void Claim(this IVirtualMachinesOperations operations, string labName, string name) - { - operations.ClaimAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Take ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task ClaimAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ClaimWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Detach the specified disk from the virtual machine. This operation can take - /// a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for detaching data disk from a virtual machine. - /// - public static void DetachDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) - { - operations.DetachDataDiskAsync(labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); - } - - /// - /// Detach the specified disk from the virtual machine. This operation can take - /// a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for detaching data disk from a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task DetachDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Lists all applicable schedules - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static ApplicableSchedule ListApplicableSchedules(this IVirtualMachinesOperations operations, string labName, string name) - { - return operations.ListApplicableSchedulesAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Lists all applicable schedules - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task ListApplicableSchedulesAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListApplicableSchedulesWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Start a virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void Start(this IVirtualMachinesOperations operations, string labName, string name) - { - operations.StartAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Start a virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task StartAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.StartWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Stop a virtual machine This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void Stop(this IVirtualMachinesOperations operations, string labName, string name) - { - operations.StopAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Stop a virtual machine This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task StopAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.StopWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Create or replace an existing Virtual machine. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// A virtual machine. - /// - public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine) - { - return operations.BeginCreateOrUpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing Virtual machine. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// A virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void BeginDelete(this IVirtualMachinesOperations operations, string labName, string name) - { - operations.BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Attach a new or existing data disk to virtual machine. This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for adding a new or existing data disk to a virtual machine. - /// - public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties) - { - operations.BeginAddDataDiskAsync(labName, name, dataDiskProperties).GetAwaiter().GetResult(); - } - - /// - /// Attach a new or existing data disk to virtual machine. This operation can - /// take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for adding a new or existing data disk to a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginAddDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginAddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Apply artifacts to virtual machine. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for applying artifacts to a virtual machine. - /// - public static void BeginApplyArtifacts(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) - { - operations.BeginApplyArtifactsAsync(labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); - } - - /// - /// Apply artifacts to virtual machine. This operation can take a while to - /// complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for applying artifacts to a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginApplyArtifactsAsync(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Take ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void BeginClaim(this IVirtualMachinesOperations operations, string labName, string name) - { - operations.BeginClaimAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Take ownership of an existing virtual machine This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginClaimAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginClaimWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Detach the specified disk from the virtual machine. This operation can take - /// a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for detaching data disk from a virtual machine. - /// - public static void BeginDetachDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) - { - operations.BeginDetachDataDiskAsync(labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); - } - - /// - /// Detach the specified disk from the virtual machine. This operation can take - /// a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// Request body for detaching data disk from a virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDetachDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Start a virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void BeginStart(this IVirtualMachinesOperations operations, string labName, string name) - { - operations.BeginStartAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Start a virtual machine. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginStartAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginStartWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Stop a virtual machine This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - public static void BeginStop(this IVirtualMachinesOperations operations, string labName, string name) - { - operations.BeginStopAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Stop a virtual machine This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginStopAsync(this IVirtualMachinesOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginStopWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List virtual machines in a given lab. - /// - /// - /// 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(); - } - - /// - /// List virtual machines in a given lab. - /// - /// - /// 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; - } - } - + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IVirtualMachinesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IVirtualMachinesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IVirtualMachinesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + public static LabVirtualMachine Get(this IVirtualMachinesOperations operations, string labName, string name, string expand = default(string)) + { + return ((IVirtualMachinesOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IVirtualMachinesOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine) + { + return ((IVirtualMachinesOperations)operations).CreateOrUpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Delete(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static LabVirtualMachine Update(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachineFragment labVirtualMachine) + { + return ((IVirtualMachinesOperations)operations).UpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachineFragment labVirtualMachine, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void AddDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties) + { + ((IVirtualMachinesOperations)operations).AddDataDiskAsync(labName, name, dataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task AddDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.AddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void ApplyArtifacts(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) + { + ((IVirtualMachinesOperations)operations).ApplyArtifactsAsync(labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ApplyArtifactsAsync(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Claim(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).ClaimAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ClaimAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ClaimWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void DetachDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) + { + ((IVirtualMachinesOperations)operations).DetachDataDiskAsync(labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DetachDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static ApplicableSchedule ListApplicableSchedules(this IVirtualMachinesOperations operations, string labName, string name) + { + return ((IVirtualMachinesOperations)operations).ListApplicableSchedulesAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListApplicableSchedulesAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListApplicableSchedulesWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Start(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).StartAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task StartAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Stop(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).StopAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task StopAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine) + { + return ((IVirtualMachinesOperations)operations).BeginCreateOrUpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginDelete(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties) + { + ((IVirtualMachinesOperations)operations).BeginAddDataDiskAsync(labName, name, dataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginAddDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginAddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginApplyArtifacts(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) + { + ((IVirtualMachinesOperations)operations).BeginApplyArtifactsAsync(labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginApplyArtifactsAsync(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginClaim(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).BeginClaimAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginClaimAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginClaimWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginDetachDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) + { + ((IVirtualMachinesOperations)operations).BeginDetachDataDiskAsync(labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDetachDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginStart(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).BeginStartAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginStartAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginStop(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).BeginStopAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginStopAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return ((IVirtualMachinesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IVirtualMachinesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } } } diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs index 07911d8bfc88..30c2f8b89da2 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { + using System.Linq; 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; /// /// VirtualNetworksOperations operations. /// - internal partial class VirtualNetworksOperations : IServiceOperations, IVirtualNetworksOperations + internal partial class VirtualNetworksOperations : Microsoft.Rest.IServiceOperations, IVirtualNetworksOperations { /// /// Initializes a new instance of the VirtualNetworksOperations class. @@ -37,13 +24,13 @@ internal partial class VirtualNetworksOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal VirtualNetworksOperations(DevTestLabsClient client) + internal VirtualNetworksOperations (DevTestLabsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,25 +41,25 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// List virtual networks in a given lab. /// + /// + /// + /// /// /// The name of the lab. /// - /// - /// 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 /// /// @@ -81,79 +68,91 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("labName", labName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _virtualNetwork = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_virtualNetwork)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_virtualNetwork); } } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -165,55 +164,56 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -223,9 +223,10 @@ internal VirtualNetworksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -236,25 +237,29 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get virtual network. /// @@ -265,7 +270,7 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// The name of the virtual network. /// /// - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' /// /// /// Headers that will be added to request. @@ -273,13 +278,13 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -288,81 +293,94 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -374,55 +392,56 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -432,9 +451,10 @@ internal VirtualNetworksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -445,25 +465,29 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing virtual network. This operation can take a /// while to complete. @@ -478,16 +502,16 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// A virtual network. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -500,16 +524,16 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// The name of the virtual network. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -530,13 +554,13 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -545,81 +569,93 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string labName, string name, VirtualNetworkFragment virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, VirtualNetworkFragment virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (virtualNetwork == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualNetwork"); } - if (Client.ResourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (virtualNetwork == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetwork"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("virtualNetwork", virtualNetwork); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -631,61 +667,62 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(virtualNetwork != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(virtualNetwork, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(virtualNetwork, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -695,9 +732,10 @@ internal VirtualNetworksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -708,25 +746,29 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or replace an existing virtual network. This operation can take a /// while to complete. @@ -746,13 +788,13 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -761,81 +803,94 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (virtualNetwork == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualNetwork"); } - if (Client.ResourceGroupName == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (labName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } - if (name == null) + + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } - if (virtualNetwork == null) + + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetwork"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + tracingParameters.Add("virtualNetwork", virtualNetwork); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -847,61 +902,62 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(virtualNetwork != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(virtualNetwork, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(virtualNetwork, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -911,9 +967,10 @@ internal VirtualNetworksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -924,16 +981,16 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -942,25 +999,29 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete virtual network. This operation can take a while to complete. /// @@ -976,10 +1037,10 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -988,76 +1049,88 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string labName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ResourceGroupName == null) + + if (this.Client.ResourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("labName", labName); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } if (_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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1069,55 +1142,56 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1127,20 +1201,25 @@ internal VirtualNetworksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List virtual networks in a given lab. /// @@ -1153,13 +1232,13 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1168,51 +1247,54 @@ internal VirtualNetworksOperations(DevTestLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1224,55 +1306,56 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + System.Net.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)); + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1282,9 +1365,10 @@ internal VirtualNetworksOperations(DevTestLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1295,24 +1379,28 @@ internal VirtualNetworksOperations(DevTestLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs index e9850feacb55..43ee23e8258b 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs @@ -1,362 +1,326 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DevTestLabs { - using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for VirtualNetworksOperations. + /// Extension methods for VirtualNetworksOperations /// public static partial class VirtualNetworksOperationsExtensions { - /// - /// List virtual networks in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IVirtualNetworksOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(labName, odataQuery).GetAwaiter().GetResult(); - } + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IVirtualNetworksOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IVirtualNetworksOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } - /// - /// List virtual networks in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IVirtualNetworksOperations operations, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IVirtualNetworksOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get virtual network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + public static VirtualNetwork Get(this IVirtualNetworksOperations operations, string labName, string name, string expand = default(string)) + { + return ((IVirtualNetworksOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } - /// - /// Get virtual network. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' - /// - public static VirtualNetwork Get(this IVirtualNetworksOperations operations, string labName, string name, string expand = default(string)) + /// + /// Get virtual network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IVirtualNetworksOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(labName, name, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork) + { + return ((IVirtualNetworksOperations)operations).CreateOrUpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); + } - /// - /// Get virtual network. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IVirtualNetworksOperations operations, string labName, string name, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static void Delete(this IVirtualNetworksOperations operations, string labName, string name) + { + ((IVirtualNetworksOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing virtual network. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// A virtual network. - /// - public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork) - { - return operations.CreateOrUpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); - } + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IVirtualNetworksOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of virtual networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static VirtualNetwork Update(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetworkFragment virtualNetwork) + { + return ((IVirtualNetworksOperations)operations).UpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); + } - /// - /// Create or replace an existing virtual network. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// A virtual network. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Modify properties of virtual networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetworkFragment virtualNetwork, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork) + { + return ((IVirtualNetworksOperations)operations).BeginCreateOrUpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); + } - /// - /// Delete virtual network. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - public static void Delete(this IVirtualNetworksOperations operations, string labName, string name) + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(labName, name).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static void BeginDelete(this IVirtualNetworksOperations operations, string labName, string name) + { + ((IVirtualNetworksOperations)operations).BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); + } - /// - /// Delete virtual network. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IVirtualNetworksOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IVirtualNetworksOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IVirtualNetworksOperations operations, string nextPageLink) + { + return ((IVirtualNetworksOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Modify properties of virtual networks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// A virtual network. - /// - public static VirtualNetwork Update(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetworkFragment virtualNetwork) + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IVirtualNetworksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Modify properties of virtual networks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// A virtual network. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetworkFragment virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing virtual network. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// A virtual network. - /// - public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork) - { - return operations.BeginCreateOrUpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing virtual network. This operation can take a - /// while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// A virtual network. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete virtual network. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - public static void BeginDelete(this IVirtualNetworksOperations operations, string labName, string name) - { - operations.BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); - } - - /// - /// Delete virtual network. This operation can take a while to complete. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the virtual network. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IVirtualNetworksOperations operations, string labName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List virtual networks in a given lab. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IVirtualNetworksOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List virtual networks in a given lab. - /// - /// - /// 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 IVirtualNetworksOperations 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/DevTestLabs/DevTestLabs.Management.Sdk/README.md b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md index 0f423853b479..e0dde363d5ca 100644 --- a/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md @@ -5,14 +5,14 @@ This directory contains management plane service clients of Az.Storage module. In this directory, run AutoRest: ``` autorest --reset -autorest --use:@microsoft.azure/autorest.csharp@2.3.90 -autorest.cmd README.md --version=v2 +autorest --use:@autorest/powershell@4.x ``` ### AutoRest Configuration > see https://aka.ms/autorest ``` yaml -csharp: true +isSdkGenerator: true +powershell: true clear-output-folder: true reflect-api-versions: true openapi-type: arm diff --git a/src/DevTestLabs/DevTestLabs.sln b/src/DevTestLabs/DevTestLabs.sln index 325d16746249..065bbfc48dd2 100644 --- a/src/DevTestLabs/DevTestLabs.sln +++ b/src/DevTestLabs/DevTestLabs.sln @@ -85,7 +85,6 @@ Global {F2A68427-CD57-4A36-B602-21E00A01C731} = {3F69E5C5-71CF-4683-A9C8-53BA3A1A5DDF} {AA4EFB70-22FE-41C0-9179-6BF1422E7B0D} = {3F69E5C5-71CF-4683-A9C8-53BA3A1A5DDF} {47D9666F-225C-469C-98F1-BF687A115975} = {222F330A-327F-4122-AE98-B948918EF747} - {F1CA7D35-9D66-4C8E-82C8-BD2AE52133D6} = {222F330A-327F-4122-AE98-B948918EF747} {61354667-C9E3-45E3-9515-73060817E727} = {222F330A-327F-4122-AE98-B948918EF747} EndGlobalSection EndGlobal From c958537b3032ef6a0aaf911182f1d0188dedcf88 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:40:23 +0800 Subject: [PATCH 5/8] update and record the test --- .../ScenarioTests/PolicyTests.cs | 35 ++ .../ScenarioTests/PolicyTests.ps1 | 124 ++++- .../TestAzDtlAllowedVMSizesPolicy.json | 230 +++++++++ .../TestAzDtlAutoShutdownPolicy.json | 230 +++++++++ .../TestAzDtlAutoStartPolicy.json | 452 ++++++++++++++++++ .../TestAzDtlVMsPerLabPolicy.json | 230 +++++++++ .../TestAzDtlVMsPerUserPolicy.json | 230 +++++++++ 7 files changed, 1525 insertions(+), 6 deletions(-) create mode 100644 src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json create mode 100644 src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json create mode 100644 src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json create mode 100644 src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json create mode 100644 src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json diff --git a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs index 7aacca793325..440c996a629d 100644 --- a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs +++ b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs @@ -59,5 +59,40 @@ public void TestAzureRmDtlAutoStartPolicy() { TestRunner.RunTestScript("Test-AzureRmDtlAutoStartPolicy"); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAutoStartPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAutoStartPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAutoShutdownPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAutoShutdownPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAllowedVMSizesPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAllowedVMSizesPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlVMsPerUserPolicy() + { + TestRunner.RunTestScript("Test-AzDtlVMsPerUserPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlVMsPerLabPolicy() + { + TestRunner.RunTestScript("Test-AzDtlVMsPerLabPolicy"); + } } } diff --git a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 index 7e74ca86a404..ac3080bbfcb0 100644 --- a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 +++ b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 @@ -16,7 +16,7 @@ .SYNOPSIS Tests AzureRmDtlVMsPerLabPolicy #> -function Test-AzDtlVMsPerLabPolicy +function Test-AzureRmDtlVMsPerLabPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -44,7 +44,7 @@ function Test-AzDtlVMsPerLabPolicy .SYNOPSIS Tests AzureRmDtlVMsPerUserPolicy #> -function Test-AzDtlVMsPerUserPolicy +function Test-Test-AzureRmDtlVMsPerUserPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -70,7 +70,7 @@ function Test-AzDtlVMsPerUserPolicy .SYNOPSIS Tests AzureRmDtlAllowedVMSizesPolicy #> -function Test-AzDtlAllowedVMSizesPolicy +function Test-AzureRmDtlAllowedVMSizesPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -96,14 +96,14 @@ function Test-AzDtlAllowedVMSizesPolicy .SYNOPSIS Tests AzureRmDtlAllowedVMSizesPolicy #> -function Test-AzDtlAutoShutdownPolicy +function Test-AzureRmDtlAutoShutdownPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" try { - $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName + $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable $readBack = Get-AzDtlAutoShutdownPolicy -LabName $labName -ResourceGroupName $rgName Assert-AreEqual "Enabled" $policy.Status @@ -122,7 +122,7 @@ function Test-AzDtlAutoShutdownPolicy .SYNOPSIS Tests AzureRmDtlAutoStartPolicy #> -function Test-AzDtlAutoStartPolicy +function Test-AzureRmDtlAutoStartPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -154,3 +154,115 @@ function Test-AzDtlAutoStartPolicy Clean-ResourceGroup $rgName } } + +<# +.SYNOPSIS +Tests AzDtlAutoStartPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAutoStartPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAutoStartPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable + $readBack = Get-AzDtlAutoStartPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.WeeklyRecurrence.Time + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.WeeklyRecurrence.Time + + $policy = Set-AzDtlAutoStartPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Days Monday, Tuesday + $readBack = Get-AzDtlAutoStartPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.WeeklyRecurrence.Time + Assert-AreEqualArray ([System.DayOfWeek]::Monday, [System.DayOfWeek]::Tuesday) $policy.WeeklyRecurrence.Weekdays + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.WeeklyRecurrence.Time + Assert-AreEqualArray ([System.DayOfWeek]::Monday, [System.DayOfWeek]::Tuesday) $readBack.WeeklyRecurrence.Weekdays +} + +<# +.SYNOPSIS +Tests AzDtlAutoShutdownPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAutoShutdownPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable + $readBack = Get-AzDtlAutoShutdownPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.DailyRecurrence.Time + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.DailyRecurrence.Time +} + +<# +.SYNOPSIS +Tests AzDtlAllowedVMSizesPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAllowedVMSizesPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAllowedVMSizesPolicy -Enable -LabName $labName -ResourceGroupName $rgName -VmSizes Standard_A3, Standard_A0 + $readBack = Get-AzDtlAllowedVMSizesPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual '["Standard_A3","Standard_A0"]' $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual '["Standard_A3","Standard_A0"]' $readBack.Threshold +} + +<# +.SYNOPSIS +Tests AzDtlVMsPerUserPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlVMsPerUserPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlVMsPerUserPolicy -MaxVMs 5 -LabName $labName -ResourceGroupName $rgName + $readBack = Get-AzDtlVMsPerUserPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "5" $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "5" $readBack.Threshold +} + +<# +.SYNOPSIS +Tests AzDtlVMsPerLabPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlVMsPerLabPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + # Max VMs per lab policy + $policy = Set-AzDtlVMsPerLabPolicy -MaxVMs 5 -LabName $labName -ResourceGroupName $rgName + $readBack = Get-AzDtlVMsPerLabPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "5" $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "5" $readBack.Threshold +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json new file mode 100644 index 000000000000..8777901365e8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "050f81ad-013b-4133-8f8a-1c02a6022869" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "x-ms-correlation-request-id": [ + "f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033518Z:f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 4CB94D8DA8A542468EBF164429D685CC Ref B: MAA201060513037 Ref C: 2024-11-01T03:35:17Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:17 GMT" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/AllowedVmSizesInLab' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "220b2aa6-641a-407f-a2df-227076c301c6" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "x-ms-correlation-request-id": [ + "c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033522Z:c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: F9007A24BD274FDAAAC80A51DFF548D6 Ref B: MAA201060516031 Ref C: 2024-11-01T03:35:21Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:21 GMT" + ], + "Content-Length": [ + "522" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\",\r\n \"createdDate\": \"2024-11-01T11:35:19.9707846+08:00\",\r\n \"uniqueIdentifier\": \"7f7b005b-6055-4a88-9aa8-5032caa6b191\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/allowedvmsizesinlab\",\r\n \"name\": \"AllowedVmSizesInLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "050f81ad-013b-4133-8f8a-1c02a6022869" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "183" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "x-ms-correlation-request-id": [ + "884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033520Z:884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 983B9EF7BC444BD9BE572DAAD7432987 Ref B: MAA201060513037 Ref C: 2024-11-01T03:35:18Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:19 GMT" + ], + "Content-Length": [ + "522" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\",\r\n \"createdDate\": \"2024-11-01T11:35:19.9707846+08:00\",\r\n \"uniqueIdentifier\": \"7f7b005b-6055-4a88-9aa8-5032caa6b191\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/allowedvmsizesinlab\",\r\n \"name\": \"AllowedVmSizesInLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json new file mode 100644 index 000000000000..6e108269a9c6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6c735816-aa31-4d3a-b531-062324cffdf8" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "x-ms-correlation-request-id": [ + "34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031844Z:34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: A2D396486B89426E85F831FD2BC50FAB Ref B: MAA201060513017 Ref C: 2024-11-11T03:18:43Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:44 GMT" + ], + "Content-Length": [ + "593" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Disabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "06a4084f-8a1f-494b-8ef0-8f3d300849bf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "x-ms-correlation-request-id": [ + "e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031848Z:e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 61A544C7DA304440B69471987D88068F Ref B: MAA201060513049 Ref C: 2024-11-11T03:18:47Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:48 GMT" + ], + "Content-Length": [ + "592" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6c735816-aa31-4d3a-b531-062324cffdf8" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "414" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "x-ms-correlation-request-id": [ + "c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031847Z:c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 2132F81AE4484EB59509D83550DAB1BD Ref B: MAA201060513017 Ref C: 2024-11-11T03:18:44Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:47 GMT" + ], + "Content-Length": [ + "592" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json new file mode 100644 index 000000000000..5709d1cc3ec0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json @@ -0,0 +1,452 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4ddc8e54-3fa3-4b55-a917-b245475d937a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "x-ms-correlation-request-id": [ + "aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032158Z:aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 5051C1D4069B4897BAEA710BCFDEF0F8 Ref B: MAA201060514031 Ref C: 2024-11-11T03:21:57Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:21:57 GMT" + ], + "Content-Length": [ + "624" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Disabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1e1ea69a-d0c7-439e-bad9-33ec944bb819" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "x-ms-correlation-request-id": [ + "f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032201Z:f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 00EF6D0B4CDD43DE9A4502C484B1709E Ref B: MAA201060513047 Ref C: 2024-11-11T03:22:00Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:01 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f25a9c07-dfe5-4e80-9cfb-62f63beed59a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3748" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "248" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "x-ms-correlation-request-id": [ + "1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032202Z:1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 042F6E04C5A74250A15CCCA94AFD0E30 Ref B: MAA201060515019 Ref C: 2024-11-11T03:22:02Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:01 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "2af5f321-ca44-4c33-8996-4b5699ec97a2" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "x-ms-correlation-request-id": [ + "d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032206Z:d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 5E7C0A0CDA034800A014B921D1798FB7 Ref B: MAA201060516033 Ref C: 2024-11-11T03:22:05Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:06 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4ddc8e54-3fa3-4b55-a917-b245475d937a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "482" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "37e0a746-39c3-452c-872c-09cf43464df8" + ], + "x-ms-correlation-request-id": [ + "37e0a746-39c3-452c-872c-09cf43464df8" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032200Z:37e0a746-39c3-452c-872c-09cf43464df8" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: B5C2BE0859DB440E88440CE6FFB01069 Ref B: MAA201060514031 Ref C: 2024-11-11T03:21:58Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:21:59 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f25a9c07-dfe5-4e80-9cfb-62f63beed59a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "482" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "x-ms-correlation-request-id": [ + "5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032205Z:5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 62B531DA896E4F4695A16178A0051769 Ref B: MAA201060515019 Ref C: 2024-11-11T03:22:02Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:04 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json new file mode 100644 index 000000000000..07b688774498 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "3b664c13-5968-41e5-9d72-6cac0e054ebf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "x-ms-correlation-request-id": [ + "9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033701Z:9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: D521C054449A47E591E21E261602C4F9 Ref B: MAA201060514027 Ref C: 2024-11-01T03:37:00Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:00 GMT" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/MaxVmsAllowedPerLab' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "be9832f8-810b-4d9d-81a0-f1046e8b7e20" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "x-ms-correlation-request-id": [ + "2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033704Z:2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: F037C67B80FA42B4BC8E49761D33B9E1 Ref B: MAA201060516023 Ref C: 2024-11-01T03:37:03Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:04 GMT" + ], + "Content-Length": [ + "486" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:37:02.7060624+08:00\",\r\n \"uniqueIdentifier\": \"cf89b591-e16d-445c-8589-7e2e66484ada\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperlab\",\r\n \"name\": \"MaxVmsAllowedPerLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "3b664c13-5968-41e5-9d72-6cac0e054ebf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "147" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "x-ms-correlation-request-id": [ + "e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033703Z:e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: CD8B5BFEC81F4AF2B43002B2C15CBEEA Ref B: MAA201060514027 Ref C: 2024-11-01T03:37:01Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:02 GMT" + ], + "Content-Length": [ + "486" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:37:02.7060624+08:00\",\r\n \"uniqueIdentifier\": \"cf89b591-e16d-445c-8589-7e2e66484ada\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperlab\",\r\n \"name\": \"MaxVmsAllowedPerLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json new file mode 100644 index 000000000000..2aaa0da70b0f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1471528a-aa3c-4579-b31f-e2d705dfc543" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "de642470-c5c3-498e-940f-f472ddd7248e" + ], + "x-ms-correlation-request-id": [ + "de642470-c5c3-498e-940f-f472ddd7248e" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033650Z:de642470-c5c3-498e-940f-f472ddd7248e" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 3FCC5D72433B416DA6E8EAC05044B6B6 Ref B: MAA201060515035 Ref C: 2024-11-01T03:36:49Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:49 GMT" + ], + "Content-Length": [ + "170" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/MaxVmsAllowedPerUser' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "821f4a5b-43a4-4971-8259-a4d2e4e906e1" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "x-ms-correlation-request-id": [ + "f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033653Z:f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 34F06ACA3ED444D5BEC8C4D117AD9623 Ref B: MAA201060515017 Ref C: 2024-11-01T03:36:53Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:53 GMT" + ], + "Content-Length": [ + "497" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:36:52.1386267+08:00\",\r\n \"uniqueIdentifier\": \"ad8295e8-e847-45ef-83a2-168ab8c83789\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperuser\",\r\n \"name\": \"MaxVmsAllowedPerUser\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1471528a-aa3c-4579-b31f-e2d705dfc543" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "156" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "x-ms-correlation-request-id": [ + "307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033652Z:307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: C822483FA4E44867B3F993B67FD38CD9 Ref B: MAA201060515035 Ref C: 2024-11-01T03:36:50Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:52 GMT" + ], + "Content-Length": [ + "497" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:36:52.1386267+08:00\",\r\n \"uniqueIdentifier\": \"ad8295e8-e847-45ef-83a2-168ab8c83789\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperuser\",\r\n \"name\": \"MaxVmsAllowedPerUser\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file From 4788e9369b0789e65725dca1d8e15930d1a6648e Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:44:24 +0800 Subject: [PATCH 6/8] Update ChangeLog.md --- src/DevTestLabs/DevTestLabs/ChangeLog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DevTestLabs/DevTestLabs/ChangeLog.md b/src/DevTestLabs/DevTestLabs/ChangeLog.md index 278b331d3332..dcaa6f871d1a 100644 --- a/src/DevTestLabs/DevTestLabs/ChangeLog.md +++ b/src/DevTestLabs/DevTestLabs/ChangeLog.md @@ -18,6 +18,9 @@ - Additional information about change #1 --> ## Upcoming Release +* Migrated DevTestLabs SDK to generated SDK + - Removed "Microsoft.Azure.Management.DevTestLabs" Version "1.0.0" PackageReference + - Added DevTestLabs.Management.Sdk ProjectReference ## Version 1.0.3 * Removed the outdated deps.json file. From fd3e54b846ce4ddbf5fc731d4930e62f53e3d3e9 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Tue, 12 Nov 2024 11:59:25 +0800 Subject: [PATCH 7/8] Revert "Update ChangeLog.md" This reverts commit 4788e9369b0789e65725dca1d8e15930d1a6648e. --- src/DevTestLabs/DevTestLabs/ChangeLog.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/DevTestLabs/DevTestLabs/ChangeLog.md b/src/DevTestLabs/DevTestLabs/ChangeLog.md index dcaa6f871d1a..278b331d3332 100644 --- a/src/DevTestLabs/DevTestLabs/ChangeLog.md +++ b/src/DevTestLabs/DevTestLabs/ChangeLog.md @@ -18,9 +18,6 @@ - Additional information about change #1 --> ## Upcoming Release -* Migrated DevTestLabs SDK to generated SDK - - Removed "Microsoft.Azure.Management.DevTestLabs" Version "1.0.0" PackageReference - - Added DevTestLabs.Management.Sdk ProjectReference ## Version 1.0.3 * Removed the outdated deps.json file. From 81b0a9ead211b538c03715347daa1558108c01d5 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Tue, 12 Nov 2024 14:06:47 +0800 Subject: [PATCH 8/8] Update ChangeLog.md --- src/DevTestLabs/DevTestLabs/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DevTestLabs/DevTestLabs/ChangeLog.md b/src/DevTestLabs/DevTestLabs/ChangeLog.md index 278b331d3332..028f061a352c 100644 --- a/src/DevTestLabs/DevTestLabs/ChangeLog.md +++ b/src/DevTestLabs/DevTestLabs/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Removed "Microsoft.Azure.Management.DevTestLabs" Version "1.0.0" PackageReference ## Version 1.0.3 * Removed the outdated deps.json file.